-->
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: Setting foreign key relationships help
PostPosted: Sat Mar 04, 2006 2:43 am 
Newbie

Joined: Tue Nov 22, 2005 11:28 am
Posts: 6
Hi there..
I have a foreign key relationship between two classes for example Person and ShippingAddress. So in the database, the Person has a foreign key mapping to the ShippingAddress primary key.

I was able to create an association successfuly using a mapping like :
<many-to-one name="shipAddId"
column="SHIPID"
class="blah"
unique="true"
not-null="true"/>

The problem is that I dont really want to map to an entity.. i just want to get the primary key. So that in my person class I have getters and setter returning an Integer representing the shipAddID.

Not sure how to do that.. can anyone help.. is there any hibernate feature that would support that.. so far in my experience hibernate is really flexible so i'm sure there must be something.. can anyone please help :)


Top
 Profile  
 
 Post subject: Re: Setting foreign key relationships help
PostPosted: Sat Mar 04, 2006 3:14 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
Quote:
The problem is that I dont really want to map to an entity..

if my perception of ur prob is correct, im afraid u cant do it unless u dont ask hibernates help for the associating your entities .

Quote:
i just want to get the primary key. So that in my person class I have getters and setter returning an Integer representing the shipAddID.

may be u can still do it the hibernate way and use an appropriate HQL or criteria query according to your needs .

any other sugesstions are welcome too... :)

_________________
sHeRiN
thanks for your ratings ...... :)


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.