-->
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: Hibernate batch insert and exception handling
PostPosted: Fri Oct 07, 2011 6:55 am 
Newbie

Joined: Fri Oct 07, 2011 6:39 am
Posts: 1
Hi,
I have searched a lot but not found any information related to this (all the examples are basic & don't show the exception handling part) : when doing batch insert using Hibernate ( i.e. adding objects in a loop as session.save(object) and calling session.flush() at interval of say 50, suppose the session.flush() throws exception :

1. Is there any way to know which of the 50 objects in the batch was responsible for the exception ? ( could be 1 or more)
2. If the answer to above is "not possible" , is there any other option to do batch insert as well as know which particular objects caused the exception ( for log/audit purpose) - or it means we can't do batch insert if we want to know the Object which is failing ?
3. I understand in case of exception the whole batch of 50 objects will be rolled back. Is there any mechanism in Hibernate batch insert through which, if say 2 records of a batch of 50, have an error, the remaining 48 can still get persisted in DB ?

Thanks


Top
 Profile  
 
 Post subject: Re: Hibernate batch insert and exception handling
PostPosted: Fri Jan 20, 2012 11:17 pm 
Newbie

Joined: Thu Jan 19, 2012 5:23 pm
Posts: 1
I am facing same issue. Do you get any help


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.