-->
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: SchemaExport(hbm2ddl) ignores unique constraint on col
PostPosted: Thu Dec 06, 2012 6:10 pm 
Newbie

Joined: Tue Dec 04, 2012 7:12 pm
Posts: 3
Apologies if this is not the right forum, the Tools forum seems to be dead...

Annotation on field is like this
@Column(nullable = false, unique = true, length = MAX_CREATIVE_NAME_LENGTH)
It works fine with 3.5, sql generated as below

creativeName varchar2(50 char) not null unique,

With 4.1.8, *unique* is missing
creativeName varchar2(50 char) not null,

Adding below annotation to Entity class solved the problem
@Table(uniqueConstraints= @UniqueConstraint(
name="creativeName",
columnNames={"creativeName"}))

Is this a bug?
Thank you!

p.s. hibernate 3.5 references claims as below in the reference, is this still valid in 4.1?
Quote:
The @Table element contains a schema and catalog attributes, if they need to be defined. You can also define unique constraints to the table using the @UniqueConstraint annotation in conjunction with @Table (for a unique constraint bound to a single column, it is recommended to use the @Column.unique approach (refer to @Column for more information).


Top
 Profile  
 
 Post subject: Re: SchemaExport(hbm2ddl) ignores unique constraint on col
PostPosted: Thu Dec 13, 2012 6:20 pm 
Newbie

Joined: Tue Dec 04, 2012 7:12 pm
Posts: 3
All right, I will close this one by myself, guess the team is too busy with new release these days.

This is a known bug and has been fixed in 4.1.9.
https://hibernate.onjira.com/browse/HHH-7785


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.