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: join on composite foreign key
PostPosted: Wed May 07, 2008 8:11 pm 
Newbie

Joined: Wed May 07, 2008 8:00 pm
Posts: 3
Hi ya.

I'm using hibernate 3.2 with Oracle 10g. I can't figure out how to configure the hbm.xml file to match my table structure to my POJOs.

If I have the terminology right... I'm trying to map a property from a join done with a composite foreign key. I swear I've tried a 1000 permutations and I can't seem to get it right. Any help is appreciated.


Code:
-----------
-a        -
-----------
A_ID
DESC

-----------
-b        -
-----------
B_ID
DESC

-----------
-a_b      -
-----------
A_ID
B_ID
CODE

-----------
-log      -
-----------
A_ID
B_ID
Message

------------
Log.java
------------
Private int id;
private A a;
private B b;
private String message;
private String code;

----------------
Log.hbm.xml
----------------
<class name="Log">
   <id name="id" ...
   <many-to-one name="a" column="a_ID"/>
   <many-to-one name="b" column="b_ID"/>
   <property name="message" type="string" column="message"/>
   <join ????
/>


Top
 Profile  
 
 Post subject: Re: join on composite foreign key
PostPosted: Fri May 09, 2008 7:53 am 
Newbie

Joined: Wed May 07, 2008 10:23 am
Posts: 9
Location: Santharavur,Chirala,AP,India
Hi

I am not getting exactly what u have provided ....

Please send me the pojos and constraints....
I will try to solve your question...


Thanks
PurnachandraRao.



vincen8147 wrote:
Hi ya.

I'm using hibernate 3.2 with Oracle 10g. I can't figure out how to configure the hbm.xml file to match my table structure to my POJOs.

If I have the terminology right... I'm trying to map a property from a join done with a composite foreign key. I swear I've tried a 1000 permutations and I can't seem to get it right. Any help is appreciated.


Code:
-----------
-a        -
-----------
A_ID
DESC

-----------
-b        -
-----------
B_ID
DESC

-----------
-a_b      -
-----------
A_ID
B_ID
CODE

-----------
-log      -
-----------
A_ID
B_ID
Message

------------
Log.java
------------
Private int id;
private A a;
private B b;
private String message;
private String code;

----------------
Log.hbm.xml
----------------
<class name="Log">
   <id name="id" ...
   <many-to-one name="a" column="a_ID"/>
   <many-to-one name="b" column="b_ID"/>
   <property name="message" type="string" column="message"/>
   <join ????
/>

_________________
B.PurnachandraRao
Santharavur,Chirala,AP,India


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.