Hello, I can't seem to figure this out. Hopefully someone knows the answer. We generate our database schema from the annotated classes and the following annotation results in an unwanted unique constraint being created which further causes problems.
Code:
@OneToMany(
fetch = FetchType.LAZY,
cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }
)
@JoinTable(
name = "AuthorizationDefSKUOneWayJoin",
joinColumns = @JoinColumn(name = "AuthorizationDef_PKID"),
inverseJoinColumns = @JoinColumn(name = "skus_PKID")
)
protected Set<SKU> skus = ....;
The result of this annotation is create table plus the unique constraint on SKUS_PKID which is "system-generated". In case it matters, this is happening on DB2.
Our classes are also auto-generated from the modeling tool which should explains a weird table name. The annotations are therefore auto-generated but we have the ability to alter them, just as long as I can figure out what is causing the constraint creation.
Nowhere in the generated annotations there is any explicit mention of UniqueConstraint so perhaps it's some setting somewhere. Could it be some property in the persistence.xml?
Thanks,
Henry