-->
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.  [ 3 posts ] 
Author Message
 Post subject: @UniqueConstraint on @Table not generating contstraint
PostPosted: Wed Jul 16, 2008 1:35 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
After reading the hibnerate docs I added this annotation to my class:
Code:
@Table(uniqueConstraints={@UniqueConstraint(columnNames={"unixGroupName","hostId"})})

It did not generate any new contstraints, but it seems to be working for everyone else so I started debugging.

I found that it is finding and building the UniqueConstraints but it never sends them to the DB.

There is a call in the generateSchemaUpdateScript method of org.hibernate.cfg.Configuration that gets the unique constraints for the table but it is commented out. The only other place is called (that I can find) is in the generateSchemaCreationScript method of the same class but it does not get called since my db dialect (in this case Derby Dilect) supportsUniqueConstraintInCreateAlterTable returns true.

Is there something that I missing to get this working?

Thanks for your time, any help would be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 1:51 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
I still havent figured out what is happening here.

Should I add it to the JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2008 4:44 pm 
Newbie

Joined: Tue Sep 16, 2008 10:32 am
Posts: 2
I had the same problem and had to add @Column(nullable=false) to each field in the constraint

_________________
Andrew Morovati
Entrinsik Inc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.