-->
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.  [ 2 posts ] 
Author Message
 Post subject: Avoiding duplicate instances
PostPosted: Thu May 10, 2007 11:41 pm 
Newbie

Joined: Thu May 10, 2007 11:31 pm
Posts: 2
Hi everybody.
I have a 1-N relationship. It's mapped using bag collection.

PlanoMensal has many Ocorrencia, and an Ocorrencia has only PlanoMensal.

I'm using the id increment method. So, the problem is. Ocorrencia has a property (dayOfMonth), and I wanna avoid registers with the same dayOfMonth and the same PlanoMensal. So, is it possible to do this without using composite ids and obviously without hardcode?
TIA.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 11, 2007 1:09 am 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
On your mapping file for Ocarrencia, you can group your dayOfMonth and PlanoMensal using the <properties> logical grouping and specifying the unique constraint on it.

http://www.hibernate.org/hib_docs/v3/re ... properties

_________________
Don't forget to rate the reply if it helps..:)

Budyanto


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.