Hello,
Currently we are struggling to port our system to pure JPA (till now we were using JDO). We've encountered problems with unidirectional many-to-many association (class A has a collection of elements of class B, class B has no reference to class A). The problem is, that upon attempt of removal of an object of class A (the owning side), the operation fails with following exception:
Code:
org.postgresql.util.PSQLException: ERROR: update or delete on "A" violates foreign key constraint "fk2e5f270992a3d5a2" on "A_B"
Details: Key (identifier)=(64) is still referenced from table "A_B".
As A is the owning side of the association, why is it not possible to remove the object of this class, automatically discarding the association? Is it possible to achieve this effect with another combination of annotations?
I've tried to make an one-to-many association with overriding inverse join column unique property, but the trick does not work (the foreign key in the join table is created with an unique constraint regardless of the @JoinTable.@JoinColumn settings).
Help greatly appreciated, as I'm trying to deal with the problem for 3 days now...
best regards
Marek