-->
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: unique key one propery and foreign key with bidirectional??
PostPosted: Sun Feb 25, 2007 3:45 am 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
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


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.