WARNING: SQL Error: 1062, SQLState: 23000 SEVERE: Duplicate entry '*' for key '************'

May 14, 2013 4:35:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 1062, SQLState: 23000
May 14, 2013 4:35:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Duplicate entry '2' for key 'navigation_id'
May 14, 2013 4:35:23 PM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SEVERE: 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:96)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:183)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)


Following is the screenshot of actual scenario .



Here is the solution for above problem. Just I used @JoinColumn annotation 




1 comment:

Hemraj said...

Sometime it get solved by changing @OneToMany to @ManyToMany if owner entity is not awing the referred entity.

Popular Posts