We have been trying to annotate a two column unique constraint onto a table with no success.
The annotation looks like this:
@Entity @Table( name="mytable", uniqueConstraints={ @UniqueConstraint( columnNames={ "MY_COLUMN_1", "MY_COLUMN_2" } ) } ) public class MyEntity ...etc
We have the following libraries in the build: hibernate-core 3.5.6-Final hibernate-jpa-2.0-api 1.0.0.Final hibernate-annotations 3.5.6-Final hibernate-c3p0 3.5.6-Final
And we're running against DB2.
We can build the database successfully from the hibernate annotations, the @Table annotation is being applied (we can use it to change the name of the table) but the unique constraint is never applied and no errors are reported.
It is clearly trying to apply the constraint because if we supply wrong column names an exception is reported.
Any ideas gratefully received.
|