Reputation: 13258
I have a bidirectional n:m relation with two entities and I have created domain objects for using with Hibernate in the latest version 3.5.3. I used this for my example: http://tadtech.blogspot.com/2007/09/hibernate-annotation-many-to-many-join_03.html
My problem: The Addres will be added without a problem. But it does not make an insert on the join / link table. What's wrong here? Something wrong with cascading?
Thanks a lot in advance & Best Regards.
Upvotes: 0
Views: 635
Reputation: 16439
could you try to remove the @JoinTable annotation and see if it works? I assume you have all the setter/getters in the beans (if not, add them!). I believe the issue is in that fragment of code, as it has worked for me without it.
Also, I don't understand this limitation in the code you mention:
...
@JoinColumn(name="personId", unique = true)
...
To me it seems like that should be OneToMany, not ManyToMany...
Upvotes: 0
Reputation: 13258
The answer is that I have to change the mappedBy attribute to this side I want to insert something, otherwise I have to re-update the other side of the joined table one more time, so it will make an insert to the linked table.
Upvotes: 2