-->
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: Two related sets and specific column constraint
PostPosted: Wed Mar 15, 2006 10:57 am 
Newbie

Joined: Sun Mar 12, 2006 2:44 pm
Posts: 10
Hi,

I have structure where one class (Employee) has two sets of objects from another class (Client). Client has to be assigned to the one (and only one) set.

Is it possible to make that limitation (CURRENT_CLIENT_ID or FORMER_CLIENT_ID has to be not-null and they can't be not-null both) at hibernate mapping/database level? Or I have to check it at higher level?


Hibernate version: 3.1.2

Mapping documents:
Code:
<class name="Employee" (...)>

(...)

<set name="currentClients" cascade="all,delete-orphan" >
    <key column="CURRENT_CLIENT_ID"/>
    <one-to-many class="Client"/>
</set>

<set name="formerClients" cascade="all,delete-orphan">
    <key column="FORMER_CLIENT_ID"/>
    <one-to-many class="Client"/>
</set>
</class>


Name and version of the database you are using: PostgreSQL 8.1


Thanks for help
Marcin


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.