This works fine for me using
Hibernate 3.1 beta 1 and
Hibernate Annotations 3.1 beta 4.
Code:
@Column(name = "name",
nullable = false,
unique = true,
length = 128)
public String getName() {
return name;
}
Which version of Hibernate and Hibernate Annotations are you using?
Note that you
cannot use Hibernate 3.1 beta 2 with Hibernate Annotations 3.1 beta 4!
Which property do you try to make unique? Don't try to add "unique" to the primary key property. This should look like:
Code:
@Id(generate = GeneratorType.AUTO)
@Column(name = "id")
public Long getId() {
return id;
}
Best regards
Sven