-->
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.  [ 1 post ] 
Author Message
 Post subject: 4.1.8 SchemaExport(hbm2ddl) ignores unique constraint on col
PostPosted: Tue Dec 04, 2012 7:46 pm 
Newbie

Joined: Tue Dec 04, 2012 7:12 pm
Posts: 3
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  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.