Originally posted by vidya archana:
In the case of insertion do I need to generate the query, I am using the save() function given by the Session Class. Also the values in the object are coming correctly also.
No, you don't need to generate any SQL, but Hibernate does. Set Hibernate to show the SQL it is producing as Dave recommends and you will have an easier job figuring out what is wrong.
"net.sf.hibernate.JDBCException: Could not execute JDBC batch update"
This message is really generic and just says that the update failed. You need to determine the root cause.
The exception probably had another exception nested inside of it. The nested exception would print a message and stack trace right below the outer one and would indicate the cause of the exception.
You could have several levels of nested exceptions, but if you scan to the bottom of the list you will see the root cause exception. What does it say?
Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)
Could not execute JDBC batch updateDONE... !! END.
This problem is due to constraint violation. You are trying to save recoed which might be violating the constraints like Primary Key in existing records.