-->
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: ActionQueue execution order
PostPosted: Tue Jun 01, 2010 1:50 pm 
Newbie

Joined: Tue Jun 01, 2010 1:28 pm
Posts: 1
Hi,

looking at the source code of Hibernate, at org.hibernate.engine.ActionQueue class, my question is:
why the execute actions are in this order: 'insertions', 'updates', 'collectionRemovals', 'collectionUpdates', 'collectionCreations', 'deletions' ?

which problems can occur at database if I move the execution of 'collectionRemovals' and 'deletions' to the top of action list ?

Code:
public void executeActions() throws HibernateException {
      executeActions( collectionRemovals ); // my change
      executeActions( deletions ); // my change
      executeActions( insertions );
      executeActions( updates );
      executeActions( collectionUpdates );
      executeActions( collectionCreations );
   }


Top
 Profile  
 
 Post subject: Re: ActionQueue execution order
PostPosted: Mon Jun 07, 2010 1:48 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
What are you trying to accomplish with your change? The one thing that springs to mind is a scenario we bump into from time to time where we want to clear a collection and then insert new records into it but then run into unique index violations since the inserts happen prior to the deletes.

If you feel strongly about your use case you might consider raising a JIRA issue as an improvement and see what the devs say. I'm not sure if there's a hard and fast reason to the ordering or not but you could make your change and run their test suite as a starting point to see what comes off the rails.

_________________
Some people are like Slinkies - not really good for anything, but you still can't help but smile when you see one tumble down the stairs.


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.