Can anyone tell me why the SchemaUpdate is adding that unique constraint below (see debug output)? I don't want the unique constraint. What I really want is one constraint, and that is for both columns to be the "primary key" because all this is is a join table for a uni-directional one-to-one mapping. It can not be a bi-directional mapping for this application. Is there any way to do this via JPA annotations and schema update (export). If I drop the constraint, all is well. Even if there was a way to say "don't generate constraints for this object" I'd be happy :)
Here is my annotated List:
Code:
@OneToMany(fetch = FetchType.EAGER)
@JoinTable(name="TRAV_DOC_2_ACCOUNTS",
joinColumns={@JoinColumn(name="fdoc_nbr", referencedColumnName="fdoc_nbr", unique=false)},
inverseJoinColumns={@JoinColumn(name="acct_num", referencedColumnName="acct_num", unique=false)})
private List<TravelAccount> travelAccounts = new ArrayList<TravelAccount>();
Here is the debugging output:
Code:
2008-04-23 14:53:43,197 [main] D: U: DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate :: create table RICE093DEV.TRAV_DOC_2_ACCOUNTS (fdoc_nbr varchar(255) not null, acct_num varchar(255) not null, unique (acct_num))
BTW: Using Hibernate 3.2.6, EM 3.3.0, and mysql 5.x
Thanks!