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: Parent entity marked dirty on deleting child entities
PostPosted: Tue Mar 07, 2006 10:15 pm 
Newbie

Joined: Wed Aug 24, 2005 5:06 pm
Posts: 3
Hi,
We are using hibernate interceptor (hibernate 2.0 event model) to capture audit data. We often navigate through a parent entity say "Person" even for a use case to delete person akas (PersonAkas).

Person has a one to many relationship to PersonAkas, so to delete a person Aka, we have a business method inside Person:

public void removePersonAka(personAka) throws BusinessRuleException {
//Busines rules here
Iterator iter = this.getPersonakas().iterator();
while (iter.hasNext()) {

PersonAka aka = (PersomAka)iter.next();

if(personAka.getId().equals(aka.getId()) {

//Business rules here. Throw BusinessRuleException if business rule check //fails
iter.remove();
break;

}

Now, when we use this method to delete a PersonAka, even the parent entity is marked dirty and an OnFulshDirty() is called. This leads to a false update audit recrord for Person. Is there any way we can get around this?
Please note that we have not updated the "Person" itself.


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.