Hi all,
I'm using openjpa version 1.2.0 with HSQLDB and I have a verty nasty
problem using schema generator with unique constraints.
I have to classes to persist:
public class UniqueA {
...
private int uniqueValue;
}
public class UniqueB {
...
private int uniqueValue;
}
The property uniqueValue should be unique for both classes.
The first thing I used was the @Column annotation:
@Column(name="uniqueValue", unique = true)
The schema generator generates follow sql statement
...CONSTRAINT UNQ_ UNIQUE (uniqueValue)..
as soon openjpa generates the second constraint, it will fail because
the constraint name is not unique.
The second try was with the @Table annotation:
"@Table( uniqueConstraints= [EMAIL PROTECTED](columnNames=
{"uniqueValue"})})"
The schema generator generates following sql statement:
...CONSTRAINT UNQ_externalRef UNIQUE (uniqueValue)...
same as before, as soon openjpa generates the second constraint, it will
fail because the constraint name is not unique.
This is my openjpa.jdbc.SynchronizeMappings:
openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true, Indexes=true)
So i finally have no solution the let openjpa generate the correct
schema. What do I do wrong?
Thank!
Claudio