AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in 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 "hbm2ddl.auto=create" 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 - anyforum.in Rishi Kumar
523188245674
up-rate
4
down-rate

Answers


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 - anyforum.in Saksham Kumar
73433936114
Reply This Thread
up-rate
5
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in