Using Hibernate 3 with annotations, when a unique constraint is removed from the entity annotations, the constraint is not dropped from the database. DDL generation is set to update - <property name="hibernate.hbm2ddl.auto" value="update"/>
The entity initially had @Column(unique = true) on the userName. I have removed the annotation and also set it to false. In both cases the constraint remains in the database (H2).
@Entity
public class User implements Serializable {
private Long id;
private String userName;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
@Column(unique = false)
public String getUserName() {
return userName;
}
}
Is it reasonable to assume that the constraint would be dropped by the change in the annotation?
Thanks,
Greg
|