-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: many to one mapping and inverse using JPA
PostPosted: Mon Apr 28, 2008 11:13 am 
Newbie

Joined: Thu Jan 17, 2008 1:12 pm
Posts: 8
I want some advice on mapping of the relationship between two entities.

The two entities are Organization and person. A person belongs to one organization and an organization has more than one person.

I can use manytoOne annotation and map the entities. However when i do that i add a new row of organiztion to the organization table whenever i add a person row to the person table.

for example i add a person called john to person table who belongs to Health organozation. here the health organization already exists in the organization table. So how can i add the person to the person table and not add an existing health organization to the organization.

also person table has a foreign key which refers to the primary key of organizaton table.

I will be glad if anyone could help me on this. thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 28, 2008 3:17 pm 
Beginner
Beginner

Joined: Tue Jun 26, 2007 2:31 pm
Posts: 21
Try making mutable="false" in the class tag of the hibernate mapping file for the Organization

Make changes in the Organization mapping file, this should work


let me know if it works for u


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.