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
|