-->
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: Property-Ref example.
PostPosted: Mon Nov 03, 2008 8:11 am 
Newbie

Joined: Mon Nov 03, 2008 8:00 am
Posts: 2
Hi everyone,

Can anyone give me a simple example of using a property-ref to join 2 tables using a foreign key.

I have been trying in vain for a long time and all i can get is it to use the primary key not the foreign key.

Thanks in advance.

Ed


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 24, 2008 5:29 am 
Newbie

Joined: Thu Mar 16, 2006 11:20 am
Posts: 1
I am having the same problem.

Basic set-up:

I have a "simple table" with three columns, where one column is a foreign key into "other table". I want to map a value in my javabean class to a column in the "other table", using "simple table"'s foreign key, the "other table"'s primary key, and using a column in the "other table" as value for my property.

Simple table hbm:
<join table="OTHER_TABLE" inverse="true">
<key column="PRIMARY_IN_OTHER_TABLE" property-ref="myForeignKeyProperty"/>
<property name="myProperty" type="java.lang.Long"
update="false" insert="false" column="PROPERTY_COLUMN_IN_OTHER_TABLE"/>
</join>


i have tried both the object-property and the table column name for "property-ref" but it seems to ignore it and always use "simple table"'s primary key at all times.



If someone, perhaps from hibernate, could point out if there is something i have misunderstood, or if this is a known bug, i'd by very very happy.


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.