-->
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: One-to-One? Object Design Quick Question
PostPosted: Wed Dec 17, 2003 4:05 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Hi I am new to Hibernate (shock eh?) anyway I have been reading all about the parent-child relationships etc, but I can't quite figure out how to implement what I want.
Example:

Customer Class:
(customer information)
public SalesRegion region;

SalesRegion Class:
(information about that salesregion)

What I'd like is my customer class to have a link to the salesregion. However I don't really need the salesregion to hold a link to all the customers associated with it. How would I set this up? Would it be a one-to-one in customer class, and no link at all in the salesregion class?

thanks in advance!
-David


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 5:07 pm 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Ok I think I solved it.

Within my Customer class i set:

<many-to-one name="region">

and my customer class has getter/setters for SalesRegion region;


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 7:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Both would work. You'll have less constraints than with one-to-one.

_________________
Emmanuel


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.