org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

Hibernate JIRA | Priya Venkatesan | 10 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    When trying to insert successive records with CLOB column throws java.sql.BatchUpdateException: ORA-01400: cannot insert NULL error. Steps to reproduce: 1.Create a object with CLOB mapped to string dataType 2.Set CLOB value (any value > 4000 chars) 3.Call session.save on the object 4.Create another object and do not set the CLOB column value. 5.Call session.save on the object. --> Returns error Hibernate: insert into JXPTEST (name, cost, thingSize, type, lastupdate, lockToken, id2, longField, booleanField, doubleField, clobField, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding 'name' to parameter: 1 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.BigDecimalType - binding '999' to parameter: 2 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.IntegerType - binding '1' to parameter: 3 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding 'gold' to parameter: 4 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.DateType - binding '04 July 2007' to parameter: 5 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding '4c22dc2f138e21f301139253d0a700f9' to parameter: 6 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding null to parameter: 7 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.LongType - binding null to parameter: 8 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.BooleanType - binding null to parameter: 9 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.DoubleType - binding null to parameter: 10 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding null to parameter: 11 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding '4c22dc2f138e21f301139253d0a700fa' to parameter: 12 org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) 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:235) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985) at com.chordiant.persistence.HibernateDataAccess.createPoint(HibernateDataAccess.java:251) at com.chordiant.persistence.HibernateDataAccess.createSet(HibernateDataAccess.java:266) at com.chordiant.persistence.SQLDataAccess.createSet(SQLDataAccess.java:1149) at com.chordiant.persistence.test.JXPTestService.createSet(JXPTestService.java:263) at com.chordiant.persistence.test.JXPTestService.processRequest(JXPTestService.java:581) at com.chordiant.service.MasterStatelessServiceBean.processRequest(MasterStatelessServiceBean.java:535) at com.chordiant.service.GatewayHandler.processRequest(GatewayHandler.java:266) at com.chordiant.service.ejb.EJBGatewayServiceBean.processRequestObject(EJBGatewayServiceBean.java:171) at com.chordiant.service.ejb.EJBGatewayServiceCMT_p5ylky_EOImpl.processRequestObject(EJBGatewayServiceCMT_p5ylky_EOImpl.java:132) at com.chordiant.service.ejb.EJBGatewayServiceCMT_p5ylky_EOImpl_WLSkel.invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517) at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403) at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56) at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:181) Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("CCSOWNER"."JXPTEST"."ID") ---------------------------------------------------------------------------------------------------------------------------- Following is my hibernate mapping file hibernate-mapping> <class name="com.chordiant.persistence.test.Thing" table="JXPTEST" lazy="false"> <id name="Id" column="ID" type="string"> <generator class="uuid.hex"> </generator> </id> <property name="nameOfAnItemThatHasToBeThisLongToTestTheOperationalBehavior" type="string" column="name" length="80" not-null="true" lazy="false"/> <property name="cost" type="big_decimal" precision="8" scale="2" not-null="false" lazy="false"/> <property name="size" type="int" column="thingSize" length="10" not-null="false" lazy="false"/> <property name="type" type="string" column="type" length="80" not-null="true" lazy="false"/> <property name="lastUpdate" type="date" column="lastupdate" not-null="false" lazy="false"/> <property name="lockToken" type="string" column="lockToken" length="128" not-null="false" lazy="false"/> <property name="id2" type="string" column="id2" length="80" not-null="false" lazy="false"/> <property name="longField" type="long" column="longField" length="22" not-null="false" lazy="false"/> <property name="booleanField" type="boolean" column="booleanField" length="1" not-null="false" lazy="false"/> <property name="doubleField" type="java.lang.Double" column="doubleField" precision="8" scale="2" not-null="false" lazy="false"/> <property name="clobField" type="string" column="clobField" length="128" not-null="false" lazy="false"/> </class> </hibernate-mapping>

    Hibernate JIRA | 10 years ago | Priya Venkatesan
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  2. 0

    When trying to insert successive records with CLOB column throws java.sql.BatchUpdateException: ORA-01400: cannot insert NULL error. Steps to reproduce: 1.Create a object with CLOB mapped to string dataType 2.Set CLOB value (any value > 4000 chars) 3.Call session.save on the object 4.Create another object and do not set the CLOB column value. 5.Call session.save on the object. --> Returns error Hibernate: insert into JXPTEST (name, cost, thingSize, type, lastupdate, lockToken, id2, longField, booleanField, doubleField, clobField, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding 'name' to parameter: 1 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.BigDecimalType - binding '999' to parameter: 2 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.IntegerType - binding '1' to parameter: 3 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding 'gold' to parameter: 4 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.DateType - binding '04 July 2007' to parameter: 5 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding '4c22dc2f138e21f301139253d0a700f9' to parameter: 6 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding null to parameter: 7 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.LongType - binding null to parameter: 8 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.BooleanType - binding null to parameter: 9 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.DoubleType - binding null to parameter: 10 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding null to parameter: 11 2007-07-04 10:42:52,855 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.hibernate.type.StringType - binding '4c22dc2f138e21f301139253d0a700fa' to parameter: 12 org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) 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:235) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985) at com.chordiant.persistence.HibernateDataAccess.createPoint(HibernateDataAccess.java:251) at com.chordiant.persistence.HibernateDataAccess.createSet(HibernateDataAccess.java:266) at com.chordiant.persistence.SQLDataAccess.createSet(SQLDataAccess.java:1149) at com.chordiant.persistence.test.JXPTestService.createSet(JXPTestService.java:263) at com.chordiant.persistence.test.JXPTestService.processRequest(JXPTestService.java:581) at com.chordiant.service.MasterStatelessServiceBean.processRequest(MasterStatelessServiceBean.java:535) at com.chordiant.service.GatewayHandler.processRequest(GatewayHandler.java:266) at com.chordiant.service.ejb.EJBGatewayServiceBean.processRequestObject(EJBGatewayServiceBean.java:171) at com.chordiant.service.ejb.EJBGatewayServiceCMT_p5ylky_EOImpl.processRequestObject(EJBGatewayServiceCMT_p5ylky_EOImpl.java:132) at com.chordiant.service.ejb.EJBGatewayServiceCMT_p5ylky_EOImpl_WLSkel.invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517) at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403) at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56) at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:181) Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("CCSOWNER"."JXPTEST"."ID") ---------------------------------------------------------------------------------------------------------------------------- Following is my hibernate mapping file hibernate-mapping> <class name="com.chordiant.persistence.test.Thing" table="JXPTEST" lazy="false"> <id name="Id" column="ID" type="string"> <generator class="uuid.hex"> </generator> </id> <property name="nameOfAnItemThatHasToBeThisLongToTestTheOperationalBehavior" type="string" column="name" length="80" not-null="true" lazy="false"/> <property name="cost" type="big_decimal" precision="8" scale="2" not-null="false" lazy="false"/> <property name="size" type="int" column="thingSize" length="10" not-null="false" lazy="false"/> <property name="type" type="string" column="type" length="80" not-null="true" lazy="false"/> <property name="lastUpdate" type="date" column="lastupdate" not-null="false" lazy="false"/> <property name="lockToken" type="string" column="lockToken" length="128" not-null="false" lazy="false"/> <property name="id2" type="string" column="id2" length="80" not-null="false" lazy="false"/> <property name="longField" type="long" column="longField" length="22" not-null="false" lazy="false"/> <property name="booleanField" type="boolean" column="booleanField" length="1" not-null="false" lazy="false"/> <property name="doubleField" type="java.lang.Double" column="doubleField" precision="8" scale="2" not-null="false" lazy="false"/> <property name="clobField" type="string" column="clobField" length="128" not-null="false" lazy="false"/> </class> </hibernate-mapping>

    Hibernate JIRA | 10 years ago | Priya Venkatesan
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  3. 0

    Genesys Info Mart 7.6.x Release Note

    genesys.com | 1 year ago
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    help! Error after migrating from HSQL -> MySQL -> Orac | Alfresco Forums

    alfresco.com | 2 years ago
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  6. 0

    Hibernate & spring Could not synchronize database state with session

    Stack Overflow | 4 years ago | user1287569
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.exception.ConstraintViolationException

      Could not execute JDBC batch update

      at org.hibernate.exception.SQLStateConverter.convert()
    2. Hibernate
      ActionQueue.executeActions
      1. org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
      2. org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      3. org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
      4. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
      5. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
      5 frames
    3. Hibernate
      SessionImpl.flush
      1. org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
      2. org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
      3. org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
      3 frames
    4. com.chordiant.persistence
      JXPTestService.processRequest
      1. com.chordiant.persistence.HibernateDataAccess.createPoint(HibernateDataAccess.java:251)
      2. com.chordiant.persistence.HibernateDataAccess.createSet(HibernateDataAccess.java:266)
      3. com.chordiant.persistence.SQLDataAccess.createSet(SQLDataAccess.java:1149)
      4. com.chordiant.persistence.test.JXPTestService.createSet(JXPTestService.java:263)
      5. com.chordiant.persistence.test.JXPTestService.processRequest(JXPTestService.java:581)
      5 frames
    5. com.chordiant.service
      EJBGatewayServiceCMT_p5ylky_EOImpl_WLSkel.invoke
      1. com.chordiant.service.MasterStatelessServiceBean.processRequest(MasterStatelessServiceBean.java:535)
      2. com.chordiant.service.GatewayHandler.processRequest(GatewayHandler.java:266)
      3. com.chordiant.service.ejb.EJBGatewayServiceBean.processRequestObject(EJBGatewayServiceBean.java:171)
      4. com.chordiant.service.ejb.EJBGatewayServiceCMT_p5ylky_EOImpl.processRequestObject(EJBGatewayServiceCMT_p5ylky_EOImpl.java:132)
      5. com.chordiant.service.ejb.EJBGatewayServiceCMT_p5ylky_EOImpl_WLSkel.invoke(Unknown Source)
      5 frames
    6. weblogic.rmi.internal
      BasicServerRef.invoke
      1. weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
      1 frame
    7. weblogic.rmi.cluster
      ClusterableServerRef.invoke
      1. weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
      1 frame
    8. weblogic.rmi.internal
      BasicServerRef$1.run
      1. weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
      1 frame
    9. weblogic.security.acl
      AuthenticatedSubject.doAs
      1. weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
      1 frame
    10. weblogic.security.service
      SecurityManager.runAs
      1. weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
      1 frame
    11. weblogic.rmi.internal
      BasicServerRef$BasicExecuteRequest.run
      1. weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
      2. weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
      3. weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
      3 frames
    12. weblogic.work
      ExecuteThread.run
      1. weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      2. weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
      2 frames