-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: An UPDATE and a DELETE after a merge operation
PostPosted: Thu Apr 11, 2013 4:35 am 
Newbie

Joined: Sun Mar 10, 2013 7:15 pm
Posts: 2
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.