Hi,

   When using the OpenJPA OneToMany bidirection relationship, while
inserting a new record into the child table, the OpenJPA seems to update all
the other child rows which are identified by the same foreign key value id.

Lets say we have a SSN xxx-xx-xxxx of parent table and has four rows in the
child table which are referred by the same SSN. I am trying to insert a
fifth row in the child table for the same xxx-xx-xxxx. Now OpenJPA is
generating a 4 update statements on and one insert statement. I am not sure
why OpenJPA is behaving so strange, since I am explicitlly using
entityManager.persist() method  to save the child object. 

Here is relationship we have
Class Child

@OneToMany(Cascade=CascadeType.All, Fetch=FetchType.Eager)
@JoinColumns(name="id", columnDefinition="id")
private Parent parent;


Class Parent
@ManyToOne(mappedBy="parent")

I guess I might be missing some annotation to stop those updates. Could
anybody please suggest me as to how this can be avoided.

I kindly request you all to advice a workaround to avoid this, since this is
the only issue that is troubling us.

Thanks,

-- 
View this message in context: 
http://n2.nabble.com/Update-problem-in-OneToMany-bidirection-relationship-tp2447599p2447599.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to