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