-->
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: Unique Constraint Annotation
PostPosted: Thu Feb 16, 2006 4:21 am 
Newbie

Joined: Thu Jan 26, 2006 4:26 am
Posts: 16
Hello, im using Hibernate 3.1.2 with last version of Annotations. Im trying to use a multiple Column unique constraint. My constaint definition is:

Code:
@Table(
uniqueConstraints={@UniqueConstraint(columnNames={"techName","version"})}
)


where version is a field that are in a Composite class.


Code:
    * Techinque Name.
    */
   private String techName           = null;
   
   /**
    * Version of technique.
    */
   private VersionComponent version  = null;


My problem is that if the version parameter is not a composite class, then all works perfectly, but if this attribute (like this case) is a composite or a foreign key, two constraits are build. Let me explain that this composite has a field called version:
Quote:
CONSTRAINT technique_techname_key UNIQUE (techname),
CONSTRAINT technique_techname_key1 UNIQUE (techname, version)


and that's a problem because using PostgreSQL 8.0, are used technique_technqme_key violation, and that's incorrect because the constraint validation must affect both fields.

Thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 4:31 am 
Newbie

Joined: Thu Jan 26, 2006 4:26 am
Posts: 16
Sorry a mistake with postgresql, because i was executing another script that modifies database, so uniqueconstraints was overwritten. Sorry.


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.