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).