Attributes on Many-to-Many relationships (Hibernate)

前端 未结 2 1853
失恋的感觉
失恋的感觉 2021-01-02 13:06

I have entity classes A and C. They are mapping the tables tblA and tblC and have a many-to-many relationship between them, with tblB to map between them. tblB contains A_ID

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-02 13:55

    From what I know, it is not possible to map it this way, you have to switch to One-To-Many and a Many-To-One relationships, with your B in the middle. Your date will be an attribute of B.


    For this lack of evolutivity, the Hibernate documentation recommends to avoid the Many-To-Many in general, and use the two relationships from the beginning.

提交回复
热议问题