-->
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: <property-ref>
PostPosted: Thu Jun 28, 2007 2:50 pm 
Beginner
Beginner

Joined: Sat Dec 03, 2005 11:12 am
Posts: 27
Hi,

Could any one explain when to use <property-ref> with a simple example?


Top
 Profile  
 
 Post subject: property-ref
PostPosted: Thu Jun 28, 2007 6:47 pm 
Beginner
Beginner

Joined: Mon Jun 25, 2007 11:57 pm
Posts: 28
Hi,

Well i just had to use that attribute myself there in order to get past a hump.

Was trying to link two tables on columns which weren't actually constrained to each other in any way.

It was just business logic that maintained the constraint, which isn't ideal but nothing i can do about that.

So in order to link the columns, i used property-ref in order to tell Hibernate the actual column i wanted to link on.

Here's the code i used:

<set name="relatedAccounts"
fetch="join">
<key column="DLWC_ACCOUNT_ID" property-ref="dlwcAccountId"/>
<one-to-many class="dnr.gov.wis.model.AccountRoles"/>
</set>

Note: the column is named DLWC_ACCOUNT_ID in both places.

If it was different, you would use the column name of the present class in the column attribute and the Java property name of the other class.


Hope this helps
John


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 28, 2007 6:49 pm 
Beginner
Beginner

Joined: Mon Jun 25, 2007 11:57 pm
Posts: 28
Meant to say in previous post:

If it was different, you would use the column name of the present class in the column attribute and the Java property name of the other class as the property-ref attribute.


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.