HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
1. Feel Free to ask and submit anything on and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.

hibernate-exception-handling: Why i am getting batch not update exception in Hibernate?

when i use "" in hibernate.cfg.xml it is creating new table and inserting values in DB Table.
but when i used "update" in the palace of "create", it is showing me error like batch not update exception what is it

why it is getting error?

hibernate x 23
exception-handling x 24
Posted On : 2014-06-18 23:38:20.0
profile Rishi Kumar - Rishi Kumar


By using this property it automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly. It can have four values.

1. validate- existing schema
2. update- only update your schema once created
3. create- create schema every time
4. create-drop- the database schema will be dropped when the SessionFactory is closed explicitly.

You will get BatchUpdateException when you call the method executeBatch if
1). one of the SQL statements you added to the batch produces a result set (usually a query)
2). one of the SQL statements in the batch does not execute successfully for some other reason.

So in your case when you use create it creates new schema at each time, but when you use update somehow there may be one of the above reason.

Posted On : 2014-06-19 00:02:09
Satisfied : 1 Yes  0 No
profile Saksham Kumar - Saksham Kumar
Reply This Thread

Post Answer
Please Login First to Post Answer: Login login with facebook -