JPA - EmbeddedId with @ManytoOne

后端 未结 2 929
无人及你
无人及你 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).

提交回复
热议问题