[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5183?page=c...
]
Emmanuel Bernard updated HHH-5183:
----------------------------------
Description:
When @SecondaryTable is declared (with the same secondary table name)
in 2 distinct entities that belong to the same hierarchy (single table inheritance),
hibernate considers
that the secondary tables are different!
Indeed, when persisting the entity, if the properties (using the secondary table) are set
in
the entity itself and its parent, hibernate does 2 inserts on the secondary table instead
of one
(one for the 'secondary' property of the parent, and one for the
'secondary' property of the current entity)
This triggers a pk violation exception as the same PK is used twice on the secondary
table.
was:
When @SecondaryTable is declared (with the same secondary table name)
in 2 distinct entities that belong to the same hierarchy (single table inheritance),
hibernate considers
that the secondary tables are different!
Indeed, when persisting the entity, if the properties (using the secondary table) are set
in
the entity itself and its parent, hibernate does 2 inserts on the secondary table instead
of one
(one for the 'secondary' property of the parent, and one for the
'secondary' property of the current entity)
This triggers a pk violation exception as the same PK is used twice on the secondary
table.
Affects Version/s: (was: 3.3.2)
3.5.1
Component/s: core
Issue Type: New Feature (was: Bug)
Summary: Use the same @SecondaryTable on a class and its subclass (was:
Inheritance (single table) and @SecondaryTable )
Actually this is something we explicitly do not support today. It looks super wrong if you
ask me (either your db schema or your inheritance approach).
I am not sure how easy core can cope with de-duplicating the tables and jungle between the
entity and its subclasses. But that may be possible. If someone wants to help contribute
the feature, please contact us on the dev mailing list or on IRC.
Use the same @SecondaryTable on a class and its subclass
--------------------------------------------------------
Key: HHH-5183
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5183
Project: Hibernate Core
Issue Type: New Feature
Components: core
Affects Versions: 3.5.1
Environment: Hibernate 3.3.2.GA
H2 Database version 1.2.131
Reporter: Nicolas Romanetti
When @SecondaryTable is declared (with the same secondary table name)
in 2 distinct entities that belong to the same hierarchy (single table inheritance),
hibernate considers
that the secondary tables are different!
Indeed, when persisting the entity, if the properties (using the secondary table) are set
in
the entity itself and its parent, hibernate does 2 inserts on the secondary table instead
of one
(one for the 'secondary' property of the parent, and one for the
'secondary' property of the current entity)
This triggers a pk violation exception as the same PK is used twice on the secondary
table.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira