-->
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: [relations][1-n on database side][1-1 on object side]
PostPosted: Tue Jul 17, 2007 9:25 am 
Newbie

Joined: Tue Jul 17, 2007 9:05 am
Posts: 9
Hi all,
I'm encountering the following problem :

I have got 2 Entities, Client and ClientDef as follows :

Code:
<class name="Client" table="TB_CLIENT">
   <id name="id" column="CLIENT_ID" type="long">
      <generator class="native" />
        </id>
       <bag name="clientDefs" cascade="all">
            <key column="CLIENT_ID" />
            <one-to-many class="ClientDef"/>
        </bag>
  </class>


Code:
<class name="ClientDef"  table="TB_CLIENT_DEF">
   <id name="id" column="CLIENT_DEF_ID" type="long">
      <generator class="native" />
        </id>
       <property name="creationDate"/>
      <property name="terminationDate"/>
  </class>



I am not happy with above "bag" collection, because it always carries a single element. (according to the current date, there is only one ClientDef that matches the given client).

Do you know how I can turn that collection into a simple association ? (Client -> ClientDef).
Best regards,
Michael.


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.