synchronize database state with session
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi All,
I am getting this exception when i try to do insertion to DB using Hibernate
The exception is as follows:
(JDBCExceptionReporter.java:72) - Duplicate key or integrity constraint violation message from server: "Duplicate entry '10.50.34.36-Authentication Failure' for key 'PRIMARY'"
ERROR [2011-09-14 01:17:45] [Thread-11] (AbstractFlushingEventListener.java:299) - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.tel.Database.DBAlarmCRUD.insert(NMSDBAlarmCRUD.java:110)
at com.tel.Fault.FaultEventHandler.handleEvent(NMSFaultEventHandler.java:100)
at com.tel.Fault.FaultTrapHandler.handleTrap(NMSFaultTrapHandler.java:62)
at com.tel.Fault.FaultTrapReceiver.run(NMSFaultTrapReceiver.java:204)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '10.50.34.36-Authentication Failure' for key 'PRIMARY'"
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1492)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
And in the insert method at this line : transaction.commit(); the exception is shown.
Thanks in advance,
I am getting this exception when i try to do insertion to DB using Hibernate
The exception is as follows:
(JDBCExceptionReporter.java:72) - Duplicate key or integrity constraint violation message from server: "Duplicate entry '10.50.34.36-Authentication Failure' for key 'PRIMARY'"
ERROR [2011-09-14 01:17:45] [Thread-11] (AbstractFlushingEventListener.java:299) - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.tel.Database.DBAlarmCRUD.insert(NMSDBAlarmCRUD.java:110)
at com.tel.Fault.FaultEventHandler.handleEvent(NMSFaultEventHandler.java:100)
at com.tel.Fault.FaultTrapHandler.handleTrap(NMSFaultTrapHandler.java:62)
at com.tel.Fault.FaultTrapReceiver.run(NMSFaultTrapReceiver.java:204)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '10.50.34.36-Authentication Failure' for key 'PRIMARY'"
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1492)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
And in the insert method at this line : transaction.commit(); the exception is shown.
Thanks in advance,
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Welcome to the Ranch, Nami!
This is the direct cause of your problem:
Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '10.50.34.36-Authentication Failure' for key 'PRIMARY'"
You, or your software, is trying to put the text '10.50.34.36-Authentication Failure' in a database field that requires that all values are unique, and that field already contains that text in another record. You are violating a primary key constraint.
This is the direct cause of your problem:
Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '10.50.34.36-Authentication Failure' for key 'PRIMARY'"
You, or your software, is trying to put the text '10.50.34.36-Authentication Failure' in a database field that requires that all values are unique, and that field already contains that text in another record. You are violating a primary key constraint.
OCUP UML fundamental and ITIL foundation
nami shekar
Greenhorn
Posts: 17
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi Jan Cumps,
Thank you for your reply
Say suppose i have hundred data to be inserted into DB
50 or 60 may get inserted without any probelm, and later i get this problem.
And few times without any problem the code works fine. Why is it so?
Thank you for your reply
Say suppose i have hundred data to be inserted into DB
50 or 60 may get inserted without any probelm, and later i get this problem.
And few times without any problem the code works fine. Why is it so?
| Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |








