-->
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.  [ 2 posts ] 
Author Message
 Post subject: Why does the moved object still exsit in the association?
PostPosted: Fri Jan 12, 2007 6:59 am 
Newbie

Joined: Tue Dec 19, 2006 4:14 am
Posts: 8
A conference has many calls. The following codes move a call (id:6578) from one conference (id:6821) to another conference(id:7474).
Code:
   @Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
   public void moveCall(String command) {
      String[] args = command.split( " " ) ;
      long callid = Long.valueOf( args[1] ) ;
      long confid = Long.valueOf( args[2] ) ;
      McpConference conf = confDao.find( confid ) ;
      McpCallLeg call = confDao.findCall(callid) ;
      call.setConference( conf ) ;
      conf.addCallLeg( call ) ;
   }

After the above method executed, the data in the database changed correctly, but when I call the entityManager.find() to list the conent of the two conferneces in another transaction (another method), I find that the call (id:6578) listed in the two conference.

What is wrong in my code?

I used EhCacheProvider in this application. J2SE, JDK 1.5, Hibernate 3.2.1, Spingframework 2.0.1

Thanks for your help very much!

BTW, I want to buy a eBook of "Java Persistence with Hibernate", but the above link on the page can not be accessed, where is the eBook?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 12, 2007 9:36 am 
Newbie

Joined: Tue Dec 19, 2006 4:14 am
Posts: 8
The following is the calls property definition.

Code:
    @OneToMany(mappedBy="conference", cascade={CascadeType.ALL}, fetch = FetchType.EAGER )
    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
    @org.hibernate.annotations.MapKey(columns=@Column(name="legId"))
    private Map<Long, McpCallLeg> calls = new HashMap<Long, McpCallLeg>();


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

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.