This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to link existing record from database table in ManyToMany Uni-directional relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to link existing record from database table in ManyToMany Uni-directional relationship" Watch "How to link existing record from database table in ManyToMany Uni-directional relationship" New topic
Author

How to link existing record from database table in ManyToMany Uni-directional relationship

Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi Forum members,

I would like some advice on how to associate/reference existing entities from database in a ManyToMany Uni-directional between County and School entities relationship. Below is the CountyBean.createCounty(County) which replaces any School records passed through County parameter with those already exist in SCHOOL table:


It is on line 17 of CountyBean where I want to only associate/link an existing School from DB with current County, instead of generating an additional duplicate School record in order to keep SCHOOL table normalize.

Your suggestion would be very much welcome.

Many thanks,

Jack
Jack Bush
Ranch Hand

Joined: Oct 20, 2006
Posts: 235
Hi Everyone,

Is there anyone out there who can help me with this question? Am I on the wrong track altogether?

Thanks,

Jack
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to link existing record from database table in ManyToMany Uni-directional relationship
 
Similar Threads
Meet-in-the-middle mapping question
JPA CascadeType enquiry
Still getting duplicate in JPA ManyToMany Entity Relationship
How to add JPA ManyToMany records?
@ManyToOne & @JoinColumn