-->
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: FLushMode AUTO commits changes partially
PostPosted: Sat Aug 06, 2011 11:47 am 
Newbie

Joined: Sat Aug 06, 2011 3:22 am
Posts: 1
In my application, I have entities for Registration, Bill and BillLineItems.
Registration has OneToOne relationship with Bill, and Bill has OneToMany with BillLineItems. There is a mapping table between Bill and BillLineItems as per the default hibernate strategy.

When the user creates line items to be added to a bill and submits, I do the following (code is long, so I am summarising):
-Start a new transaction
-find() the appropriate registration object
-Validate each line item and put it into a temporary list
-If any item shows an error, rollback the transaction and return to the screen; if not, put item into a list
-Add the list into the bill object of registration
-Do merge() on registration
-Commit the transaction

FlushMode is AUTO.

This works fine 99.9% of the time. But once in a while (about one transaction per day), there are line items in the BillLineItems table for which there are no mapping entries in the mapping table. These items are just hanging and are not part of any bill. Users did not report any exception, nor is there any exception in the logs (debug is enabled).
CAn anyone tell me what's happening? My only guess is that some items got flushed before a validation error was reached. But this is a common scenario and I cannot understand why it should occur so rarely. At every validation error I do a rollback anyway. I changed to Flushmode COMMIT and have not encountered any hanging row for the last two days. Don't know if it has fixed the problem.

But I really need to know if tehre is something wrong I am doing or expecting hibernate to do. Please help.


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.