-->
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: how to properly map this case
PostPosted: Fri Jun 30, 2006 2:35 am 
Newbie

Joined: Fri Jun 30, 2006 2:16 am
Posts: 4
Here's the data I'm trying to map:

Code:
Table 1 has a composite primary key (ID1, ID2) and a foreign key to Table 2

ID1    ID2    FK
----   ----   ----
1111   1234   5555
1111   5678   NULL
2222   1234   NULL
2222   5678   NULL

Table 2 is just a header table that lists valid IDs

ID
----
4444
5555
6666


Table 3 contains that data that I want to retrieve

ID5   Value
----  -------
4444  TEST1
4444  TEST2
5555  TEST3
5555  TEST4

(ID5 is a foreign key to Table 2 as well)


So for '5555', I want to retrieve a Set containing 'TEST3' and 'TEST4'

What would be the proper way to map this?

I tried the following:

Code:
File 1:

   <class name="Class1" table="SomeTable">
      <composite-id name="id" class="SomeKeyClass">
         <key-property name="a" type="string" />
         <key-property name="b" />
      </composite-id>
      <property name="refID" type="string" />
      <set name="someSet" lazy="false">
         <key column="columnID" property-ref="refID" />
         <one-to-many class="EntryInfo" />
      </set>
   </class>

File 2:
   <class name="EntryInfo" table="ThirdTable">
      <composite-id name="id" class="SomeOtherKeyClass">
         <key-property name="refID" type="string" />
         <key-property name="y" type="string" />
      </composite-id>
      <property name="z" />
   </class>


Last edited by kryptolus on Fri Jun 30, 2006 9:30 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 30, 2006 9:27 am 
Newbie

Joined: Fri Jun 30, 2006 2:16 am
Posts: 4
<deleted>


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.