-->
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: Mapping many-to-one question
PostPosted: Fri Aug 17, 2007 11:42 am 
Newbie

Joined: Mon Aug 06, 2007 4:28 pm
Posts: 3
Hibernate 3

Oracle 9i

I work with a legacy database. In a table I have the key of two others
tables, Account and Treaty.
The key of Account is no_cie. A treaty is associated to an Account and
its key contains the Account key also, then no_cie and no_treaty is its
key.

Then in the table I have to map, no_cie and no_treaty exist.
Sometimes no_cie and no_treaty are both filled then I have a treaty,
but sometimes only the no_cie is filled then I only have an Account.

So far with many-to-one property I load both of then if I have
a Treaty and only the Account if no_treaty is null.
Here's the code

Quote:
<many-to-one name="treaty" class="Treaty" >
<column name="NO_CIE" />
<column name="NO_TRAITE" />
</many-to-one>
<many-to-one name="account" class="Account" >
<column name="NO_CIE" />
</many-to-one>


I would like, to be able to load an Account or a Treaty but
not both.

Any ideas??


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.