Reputation: 314
I am using hibernate, jboss6.0.final and I am getting following exception:
ERROR: duplicate key value violates unique constraint "tablename"
Detail: Key (pkey)=(11929) already exists.
2011-07-18 06:28:04,373 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (http-69.89.2.245-8080-1) 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:94) [:3.6.0.Final]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [
I have excluded the jta.jar from hibernate-core.jar in my pom.xml. What is the reason?
Upvotes: 0
Views: 3895
Reputation: 32567
The record you're trying to insert already exists. You need to use update
or saveOrUpdate
.
Upvotes: 1