I have an object model as follows:
Code:
@Entity
public class CriteriaGroup {
...
@OneToOne(cascade = CascadeType.ALL)
private ClinicalStatement criterion;
@OneToMany
private List<CriteriaGroup> groups;
...
When I try to update an existing a CriteriaGroup with a code as below,
an update and a delete operation take place.
Code:
public CriteriaGroup updateCriteriaGroup(CriteriaGroup criteriaGroup) {
PersistentResource pr = openPersistenceResources();
try {
CriteriaGroup merged = pr.getEm().merge(criteriaGroup);
...
In the existing object the
groups field is null and when I do an update, I change some values within only the
criterion field. And the update operation is done on the
ClinicalStatement table but delete operation is done on the
CriteriaGroup table. Why this delete operation occurs?
Thanks for your answers, in advance.