Hellu,
I have a class A and B.
A contains a set of B's. The foreign keys of A are stored in B.
I don't have a link from B to A.
But still I like to put a unique constraint over a propery in B and the foreign key in B to A.
How is this possible?
I noticed that it is possible when I make a many-to-one relation from B to A, but I don't want that.
Ofcourse I can do it in the database, like a normal do, but this time I like the hbm file to be leading ;)
An example of A and B can be find below.
Please some help.
Cheers,
Ed
PS: I looked at unique-key and id-natural... but it's not suitable I think.
<class name="A" table="tableA">
<id name="id" column="id" />
<set name="bs">
<key column="idA" not-null="true" />
<one-to-many class="B" />
</set>
</class
<class name="B" table="tableB">
<id name="id" column="id" />
<property name="bla" type="string" />
</class
|