-->
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: How to delete orphans many-to-one reversly composite assoc.
PostPosted: Sat Mar 14, 2009 5:27 pm 
Newbie

Joined: Sat Mar 14, 2009 5:07 pm
Posts: 3
I have following problem, but I can't google sollution.

Let's suppose follwing (just)example. We have a political Party which registers its Members. From point of view of my application this is composition, because it makes no sense to have member without his party. It looks like normal composite one-to-many association, but wait..., the biggest political party in my hypothetical country has 20M Members. And I never want to fetch all this members at once and inicialisation of such a big collection would crash my system.
So I decided to model this situation as many-to-one association where Member see his political Party. Now I can filter and page members and everything is OK. From design point of view is this sollution excelent, but I don't know how to set up automatic cascade delete of all orphan Members when their party is removed from system.
So what I need is to mark somehow this many-to-one association as reversly composite and delete orphan Members when their party is deleted.
How to do this in hibernate mapping?

Example is just hypothetical. I ave quite good experience with this design pattern and I want to use it many times without writing custom code, which would fetch and delete all members before their party is deleted.


Top
 Profile  
 
 Post subject: Any suggestions?
PostPosted: Tue Mar 17, 2009 5:23 am 
Newbie

Joined: Sat Mar 14, 2009 5:07 pm
Posts: 3
Is there any suggestions? If its not possible, it would be good request for enhancment to manage such as many to one associations.


Top
 Profile  
 
 Post subject: Any suggestions?
PostPosted: Tue Mar 17, 2009 5:25 am 
Newbie

Joined: Sat Mar 14, 2009 5:07 pm
Posts: 3
Is there any suggestions? If its not possible, it would be good request for enhancment to manage such as many to one associations.


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.