-->
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: uniqueness over two columns depending one columns value
PostPosted: Mon Jan 05, 2004 11:24 am 
Newbie

Joined: Mon Jan 05, 2004 11:04 am
Posts: 16
Hi,

I have a POJO BookLent with several properties.
2 of them are bookId and isCurrent.
/**
* @return Long
* @hibernate.property column="book_id" type="long"
* not-null="true" unique="false"
*/
public Long getBookId() {
return bookId;
}

/**
* @return boolean
* @hibernate.property
* column="current" type="boolean"
*/
public boolean getIsCurrent() {
return isCurrent;
}

Every one for itself is not unique but there should be always
0 or 1 records in the db with the same book_id and current=true.

How can I manage this using XDoclet ?

TIA,
Siegbert


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2004 12:09 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't think you can. This is a business rule. You can either implement the Validate interface or add a business layer before Hibernate one.

_________________
Emmanuel


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.