-->
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: composite id with property-ref
PostPosted: Wed Jan 19, 2011 7:18 am 
Newbie

Joined: Wed Dec 15, 2010 7:55 am
Posts: 7
Hi,

I'll try to explain my problem in a simple example:

I have two tables:

Person---> id(pk), name, person_number
Test--> test_number(pk), person_number(pk),

What I want to do is to map person_number in Test with person_number in Person using Hibernate mapping file.
I've tried:


Code:
<hibernate-mapping package="xxx">
    <class name="Test" table="TEST" >       
        <composite-id name="id" class="TestId">
            <key-property name="testNumber" type="int" column="TEST_NUMBER"/>     
            <key-many-to-one name="person" class="Person" column="PERSON_NUMBER" property-ref="personNumber"/>
        </composite-id>         
    </class>
</hibernate-mapping>


It works when outside the composite id, but that's not an accepted solution:

Code:
<hibernate-mapping package="xxx">
    <class name="Test" table="TEST" >       
        <composite-id name="id" class="TestId">
            <key-property name="testNumber" type="int" column="TEST_NUMBER"/>     
            ..some more...
        </composite-id>
        <many-to-one name="person" class="Person" column="PERSON_NUMBER" property-ref="personNumber"/>       
    </class>
</hibernate-mapping>


Can anyone help? Been stuck on this for a while now:)


Last edited by RoarF on Wed Jan 26, 2011 6:09 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: composite id with property-ref
PostPosted: Fri Jan 21, 2011 5:15 am 
Newbie

Joined: Wed Dec 15, 2010 7:55 am
Posts: 7
No one knows?


Top
 Profile  
 
 Post subject: Re: composite id with property-ref
PostPosted: Wed Jan 26, 2011 6:08 pm 
Newbie

Joined: Wed Dec 15, 2010 7:55 am
Posts: 7
Seems like this is the first time I'm not able to solve a problem in Hibernate, and have to use sql instead.
My only other solution would be to use a theta-style outer join, that neither seems to be supported in Hibernate, does anyone know if this is possible?


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.