开发者

Hibernate component

I need to migrate some hibernate hbm files to JPA/Hibernate annotations. The existing relationship is as follows -

  1. The parent class has an ID
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜