Skip to main content

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

You mention that you have 'both owning sides'. Only one side of the relationship should be owning. The other should be using the mapped-by attribute in the @ManyToMany annotation. Perhaps you could provide some source for a better understanding of what you are doing?
--Gordon

Mohsen Saboorian wrote:
Hi,
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?

Thanks,
Mohsen.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top