If I have a parent/child relationship, is there a way to modify the parent and the child, but then only save the child's changes? I am currently trying this, but the save when called on the child still does a save on the parent as well.
Parent contains:
Code:
@OneToOne(mappedBy="parent",cascade=CascadeType.REMOVE,orphanRemoval=true)
private Child child;
Child contains:
Code:
@OneToOne
@JoinColumn(name="ParentID")
private Parent parent;
Code that doesn't work as intended:
Code:
Parent p = pDAO.getAll().get(0);
Child c = p.getChild();
c.setName("NEW NAME " + Calendar.getInstance().getTime());
p.setName("A NEW NAME " + Calendar.getInstance().getTime());
cDAO.save(c);
Is what I am trying to do possible by modifying my mappings?
Thanks,
Adam