Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Problem with ManyToMany mapping

I have a @ManyToMany mapping from a entity to itself. Since there is
no property for the relation, I just used a @JoinTable along with
@ManyToMany. The problem is updateing. Suppose I have A <=> B. Inside
a transaction, I remove A-B relation, from both owning sides, and
again set a reference to B in A ref list and vice versa. Normally
EclipseLink should do nothing, since the A-B relation is again created
(inside tx), but I'm getting unique constraint violation, since
EclipseLink tries to insert another relation between A and B, in
addition to the one already exists.

Is this a problem with JPA 1.0 spec, or my updating scenario is wrong?
What is the best way to update ManyToMay without having an independent
intermediate entity?


Back to the top