-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate Association
PostPosted: Wed Dec 09, 2009 12:58 am 
Newbie

Joined: Wed Dec 09, 2009 12:42 am
Posts: 1
Hello,
I have two tables Table A and Table B

Table A has following columns
a_key - it is primary key
a_id
ac_id
ac_name

Table B has following columns

b_key - it is primary key
b_id
bc_id
ac_name_ref
bc_lable

now ac_name column of table A has same value in ac_name_ref in Table B.
but physically its not foreign key in Table B on database.
ac_name one-to-many relation with ac_name_ref
also a_id = b_id and ac_id=bc_id this is like for where criteria both columns has same values and same occurance.

for this Table A and Table B I have hbm files like follow.

A.hbm

<properties name="example">
<property name="aId" type="java.lang.Integer"/>
<property name="acId" type="java.lang.Integer"/>
<property name="acName" type="java.lang.Integer"/>
</properties>

<set name="B" inverse="false" fetch="join" lazy="false">
<key property-ref="example">
<column name=" bId"></column>
<column name="bcId"></column>
<column name="acNameRef"></column>
</key>
<one-to-many class="B" />
</set>

and If I fetch records for the same then I want records in such way
ac_name
|
bc_lable
bc_lable
bc_lable
bc_lable
bc_lable
i.e one ac_name will have n bc_lable s where ac_name = ac_name_ref

but I am getting results as
1 ac_name = 1 bc_lable where ac_name = ac_name_ref

where I am going wrogn please help me??

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.