-->
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.  [ 3 posts ] 
Author Message
 Post subject: Removing Object from Set
PostPosted: Thu Sep 30, 2010 8:07 am 
Newbie

Joined: Wed Jan 06, 2010 6:36 am
Posts: 4
Can someone give me a hint why the line "community.getAccounts().remove(acc);" does not remove the object from the set?

thx

Code:
@Test
    public void testTest(){
       
       String name = "XYZ";
       String player = "Mario";

       accountService.saveAccount(new Account(player, "topsecret"));

       Account acc = accountService.findAccoutnByName(player);
       
       Community community = new Community(name);
       
       Set<Account> x = new HashSet<Account>();
       x.add(acc);
       community.setAccounts(x);
       communityService.saveCommunity(community);
       
       community = communityService.findCommunityByName(name);

       community.getAccounts().remove(acc);

       communityService.saveCommunity(community);
    }


Top
 Profile  
 
 Post subject: Re: Removing Object from Set
PostPosted: Thu Sep 30, 2010 11:03 am 
Beginner
Beginner

Joined: Fri Nov 14, 2008 7:34 pm
Posts: 24
read about delete-orphans


Top
 Profile  
 
 Post subject: Re: Removing Object from Set
PostPosted: Fri Oct 01, 2010 6:43 am 
Newbie

Joined: Tue Feb 02, 2010 10:37 am
Posts: 13
Entity mapping files should include "cascade" as delete-orphan to persist the changes in accounts list.
This cascade is different from RDBMS level cascade.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.