have you guys ever got a problem when inserting multiple identical records into a database at the same time from multiple different applications (same software)?
I am Hibernate Session. The id attribute of the table is auto incremented.
The problem I got is ContraintViolationException
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) 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:266) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) at mil.navy.nrl.c2.persist.dao.DbConnBase.commitQueryTransaction(DbConnBase.java:495) at mil.navy.nrl.c2.persist.dao.DbConnBase.main(DbConnBase.java:114) Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into ITEM(scenarioid, dtgadded, name, type, scope, category, state, threat, timelate, uid, alert, flag, symbolid, systracknumber, localtracknumber, attributes, trackid) values ('1', NULL, NULL, '0', '0', '0', '0', '0', '0', NULL, '0', NULL, NULL, NULL, NULL, NULL, '34033') was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2602) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2725) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 9 more
|