Hibernate component
I need to migrate some hibernate hbm files to JPA/Hibernate annotations. The existing relationship is as follows -
- The parent class has an ID
- The component class also has an ID
The 2 identifiers refer to different sequences.
I have used @Embedded
and开发者_运维技巧 @AttributeOverride
in the parent class, and @Embeddable
in the component class.
Both the classes are entities.
The exception i get when i try to save a parent class object is -
org.hibernate.MappingException: component property not found: id
I suppose the exception is because i have 2 identifiers defined.
Any suggestions/workarounds on this will help greatly.
You can't make something an @Entity
and @Embeddable
at the same time, that makes no sense. You have to make it one or the other.
If both have an ID, and both are entities, then the Hibernate/JPA component/embeddable model doesn't apply.
精彩评论