JPA - EmbeddedId with @ManytoOne

后端 未结 2 920
无人及你
无人及你 2020-12-19 06:03

I have a problem with my code (obviously) and after many searches on Internet, I don\'t find an answer to my problem, so I ask my question here. I have this :



        
相关标签:
2条回答
  • 2020-12-19 06:58

    Error message you get explains it quite well, Embeddable that is used as an embedded id can contain only basic mappings, not relationships. In JPA 2.0 specification this is told with following words:

    Relationship mappings defined within an embedded id class are not supported.

    Just define attributes that are part of composite id in embeddable that is used as embedded id, and map relationships in entity itself (or in another embeddable and include mappings with @Embedded).

    0 讨论(0)
  • 2020-12-19 07:04

    In my opinion this is based on the ManyToOne mapping in the IdResident class cause the error message pushs me into this direction.

    0 讨论(0)
提交回复
热议问题