-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping question
PostPosted: Wed Mar 15, 2006 3:43 pm 
Newbie

Joined: Tue Mar 07, 2006 3:57 pm
Posts: 10
I am a Hibernate newbie and still trying to figure out mapping questions.

I have a domain object Person with getter/setters for name, description etc.

This domain object has a method called
getParent(Person p)
Person setParent().


How can I show this relationship in the mapping file.

Just wondering if component or component-element would be a good choice.


Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 15, 2006 4:16 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
You should use a one-to-many with inverse=true.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 15, 2006 4:44 pm 
Newbie

Joined: Tue Mar 07, 2006 3:57 pm
Posts: 10
The Person object is related to a Person table :

1) PersonPk PK
2) ParentPerson Nulable allowed..

Each person can have a single or no parentperson

The parent which is also a person, will be retreived by the method

Person getParent()

and can be set by setParent(Person)

Would a one-to many apply in this scenario .?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.