ERROR [STDERR] javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: could not insert

Лог ошибки


02:07:32,269 WARN  [JDBCExceptionReporter] SQL Error: 1400, SQLState: 23000
02:07:32,269 ERROR [JDBCExceptionReporter] ORA-01400: cannot insert NULL into (...)
...
02:07:32,269 ERROR [STDERR] javax.persistence.EntityExistsException: 
org.hibernate.exception.ConstraintViolationException: could not insert: [...]
02:07:32,269 ERROR [STDERR]     
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:604)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
...
02:07:32,269 ERROR [STDERR] Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [...]
02:07:32,269 ERROR [STDERR]     at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
02:07:32,269 ERROR [STDERR]     at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
02:07:32,269 ERROR [STDERR]     
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
02:07:32,269 ERROR [STDERR]     ... 6 more
02:07:32,269 ERROR [STDERR] Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into (...)
02:07:32,269 ERROR [STDERR]     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
02:07:32,269 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
02:07:32,269 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
02:07:32,269 ERROR [STDERR]     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
02:07:32,299 ERROR [STDERR]     at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
02:07:32,299 ERROR [STDERR]     
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:543)
02:07:32,299 ERROR [STDERR]     
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
02:07:32,299 ERROR [STDERR]     
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
02:07:32,309 ERROR [STDERR]     
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2960)
02:07:32,309 ERROR [STDERR]     
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365)
02:07:32,309 ERROR [STDERR]     
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
02:07:32,309 ERROR [STDERR]     ... 20 more
02:07:32,509 ERROR [STDERR] javax.persistence.EntityExistsException: 
org.hibernate.exception.ConstraintViolationException: could not insert: [...]
02:07:32,509 ERROR [STDERR]     
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:604)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
...
02:07:32,509 ERROR [STDERR] Caused by: org.hibernate.exception.ConstraintViolationException: 
could not insert: [...]
02:07:32,509 ERROR [STDERR]     
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
02:07:32,509 ERROR [STDERR]     
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
02:07:32,509 ERROR [STDERR]     ... 6 more
02:07:32,509 ERROR [STDERR] Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into (...)
02:07:32,509 ERROR [STDERR]     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
02:07:32,509 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
02:07:32,509 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
02:07:32,509 ERROR [STDERR]     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
02:07:32,509 ERROR [STDERR]     
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
02:07:32,509 ERROR [STDERR]     
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:543)
02:07:32,529 ERROR [STDERR]     
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
02:07:32,529 ERROR [STDERR]     
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
02:07:32,529 ERROR [STDERR]     
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2960)
02:07:32,529 ERROR [STDERR]     
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365)
02:07:32,539 ERROR [STDERR]     
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
02:07:32,539 ERROR [STDERR]     ... 20 more

Решение


Прописать в persistence.xml для соответствующего persistence-unit правильный hibernate.dialect:

<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>