wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Problem, add new records in a many-to-many relation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem, add new records in a many-to-many relation" Watch "Problem, add new records in a many-to-many relation" New topic
Author

Problem, add new records in a many-to-many relation

babak behzadi
Greenhorn

Joined: Sep 02, 2012
Posts: 1
Hi,
I have two entities 'Person' and 'Team' which are mapped by a bidirectional many-to-many relation using annotations, as follow:


,


my service class{1, 2: According to 'Christian Bauer and Gavin King, Java Persistence with Hibernate by Manning Publication Co. Page 301, P 2'}:





And my problem: Calling method 'addTeamToPerson()' does not cause to add a new record to join table 'person_team'!!!
Note: I traced the code line by line, there's no error or exception and the transaction commits.
Please help me solve it.

regards.
babak behzadi
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem, add new records in a many-to-many relation