Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Batch update order and db triggers
PostPosted: Mon Jun 29, 2009 12:18 am 
Newbie

Joined: Sun Jun 28, 2009 11:44 pm
Posts: 1
Following is what my data structure is:
I have a table A that has information in multiple related tables. Any changes to the this table A or the related tables needs to be recorded. To store and track the completion of the processes the updates are recorded in a table U.

Problem Description:
Recently I added a trigger to the table U which would make some calculations based on the new data in A and the related tables. The problems is, when hibernate batches updates, it has a particular order in which the "insert", "update" and "delete" statements are run. Inserts are happening before the updates causing an unexpected situation. An insert in U for an update in A happens before the actual update in A happens. This causes the trigger I have written to work on the new data in A to actually works on the old data.

Possible Solution:
After the update to A call the flush method before the insert to U.

Question:
Has anyone else come across such a problem and implemented a better solution than this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.