I have an entity A containing two lists (@OneToMany) relations to two different entity types B3 and B23, but both of these entity types are derived from the same persistable entity type Bp1. So both entity types arrive in the same table for Bp1.
When automatically generating the tables (the persistence.xml property 'hibernate.hbm2ddl.auto' is set to 'create-drop').
It seems it creates a link table containing 3 columns with 'A_ID', 'B3_ID' and 'B23_ID'.
Persisting always fails:
One entry in the table contains always an entry in column A_ID, but in the other columns there is always only one filled in (should). But any insert always fails, because there is always one of the columns null, but the table definition does not allow nulls; (it contains a link either to entity of type B3 or to entity of type B23).
I suppose I hit a bug ?
Hibernate 3.2CR1 with the latests annotations and entity manager. Using a Derby database.
I will submit a bug in Jira if there is nobody who can give a correct explanation about this (just posting here because it is really asked on the site).
|