5 Replies Latest reply on Aug 15, 2011 7:44 PM by Gary Struthers

    TaskService Referential integrity constraint violation

    Gary Struthers Newbie

      I wondered why there are examples of session persistence and separate examples of TaskServer but none I can find of both of them together.

      I'm still trying to make them work together and  it's still problematic. I start the taskServer with

      <persistence-unit name="org.drools.task"> then, in main, I create

      <persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA"> with a fully qualified classname for

      org.jbpm.persistence.processinstance.ProcessInstanceInfo

       

      But when I start the process

       

      Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

      Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

      0    12/08 12:40:18,491[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

      insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

      5    12/08 12:40:18,496[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

      insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

      Hibernate: update ProcessInstanceInfo set lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?

      13   12/08 12:40:18,504[NioProcessor-1] ERROR event.def.AbstractFlushingEventListener.performExecutions - Could not synchronize database state with session

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


       

       

        • 1. Re: TaskService Referential integrity constraint violation
          Demian Calcaprina Master

          Hi Gary,

          I think what it means is that you are trying to assign a task to an entity (user or group that does not exist). Are you adding the users and groups sometime before starting the process?

           

          Demian

          1 of 1 people found this helpful
          • 2. Re: TaskService Referential integrity constraint violation
            Gary Struthers Newbie

            Thanks Demian,

             

            I was adding users but no groups. But I still have the problem with a group added.

            Hibernate: select task0_.id as col_0_0_, deadline1_.id as col_1_0_, deadline1_.deadline_date as col_2_0_ from Task task0_, Deadline deadline1_ where (deadline1_.id in (select startdeadl2_.id from Deadline startdeadl2_ where task0_.id=startdeadl2_.Deadlines_StartDeadLine_Id) or deadline1_.id in (select enddeadlin3_.id from Deadline enddeadlin3_ where task0_.id=enddeadlin3_.Deadlines_EndDeadLine_Id)) and deadline1_.escalated=0 order by deadline1_.deadline_date

            Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

            Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

            Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

            Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

            Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('Group', ?)

             

            From further down the stacktrace

                      at java.lang.Thread.run(Thread.java:680)

            Caused by: org.h2.jdbc.JdbcBatchUpdateException: Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

            insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

                      at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1119)

                      at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)

                      at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)

                      ... 37 more

            javax.persistence.RollbackException: Error while commiting the transaction

                      at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)

                      at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:820)

                      at org.jbpm.task.service.TaskServiceSession.addTask(TaskServiceSession.java:134)

                      at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:109)

                      at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)

            • 3. Re: TaskService Referential integrity constraint violation
              Gary Struthers Newbie

              I changed WSHumanTaskHandler to CommandBasedWSHumanTaskHandler and that raises enough questions to start another discussion. This looks like it is persisting both session and task but a foreign key is wrong. Here is the console log I hope someone can see the problem.

               

              Hibernate: select task0_.id as col_0_0_, deadline1_.id as col_1_0_, deadline1_.deadline_date as col_2_0_ from Task task0_, Deadline deadline1_ where (deadline1_.id in (select startdeadl2_.id from Deadline startdeadl2_ where task0_.id=startdeadl2_.Deadlines_StartDeadLine_Id) or deadline1_.id in (select enddeadlin3_.id from Deadline enddeadlin3_ where task0_.id=enddeadlin3_.Deadlines_EndDeadLine_Id)) and deadline1_.escalated=0 order by deadline1_.deadline_date

              Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

              Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

              Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

              Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)

              Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('Group', ?)

              Waiting for the Mina Server to come up

              ..Hibernate: insert into SessionInfo (id, lastModificationDate, rulesByteArray, startDate, OPTLOCK) values (null, ?, ?, ?, ?)

              Connected ? =>true

              OBJECT ASSERTED value:PIvars [id=59f8c5d6-a18c-40a6-9e37-973f0e0ad0e8, appId=0, assignedTeam=null, assignedReader=null, applicationReady=false, score=null, canScore=false, validScore=false, arRecommended=false, eligible2ndRead=false, is2ndRead=false, need3ndRead=false, requiresQC=false] factId: 1

              Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

              Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

              Hibernate: select sessioninf0_.id as id41_0_, sessioninf0_.lastModificationDate as lastModi2_41_0_, sessioninf0_.rulesByteArray as rulesByt3_41_0_, sessioninf0_.startDate as startDate41_0_, sessioninf0_.OPTLOCK as OPTLOCK41_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?

              Hibernate: select processins0_.InstanceId as InstanceId42_0_, processins0_.lastModificationDate as lastModi2_42_0_, processins0_.lastReadDate as lastRead3_42_0_, processins0_.processId as processId42_0_, processins0_.processInstanceByteArray as processI5_42_0_, processins0_.startDate as startDate42_0_, processins0_.state as state42_0_, processins0_.OPTLOCK as OPTLOCK42_0_ from ProcessInstanceInfo processins0_ where processins0_.InstanceId=?

              Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

              Hibernate: select sessioninf0_.id as id41_0_, sessioninf0_.lastModificationDate as lastModi2_41_0_, sessioninf0_.rulesByteArray as rulesByt3_41_0_, sessioninf0_.startDate as startDate41_0_, sessioninf0_.OPTLOCK as OPTLOCK41_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?

              Hibernate: insert into ProcessInstanceInfo (InstanceId, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?)

              BEFORE RULEFLOW VARIABLE CHANGED canScore=true process:Read.bp[id=XXX]

              AFTER RULEFLOW VARIABLE CHANGED canScore=true process:Read.bp[id=XXX]

              BEFORE RULEFLOW VARIABLE CHANGED vars=PIvars [id=59f8c5d6-a18c-40a6-9e37-973f0e0ad0e8, appId=0, assignedTeam=null, assignedReader=null, applicationReady=false, score=null, canScore=false, validScore=false, arRecommended=false, eligible2ndRead=false, is2ndRead=false, need3ndRead=false, requiresQC=false] process:Read.bp[id=XXX]

              AFTER RULEFLOW VARIABLE CHANGED vars=PIvars [id=59f8c5d6-a18c-40a6-9e37-973f0e0ad0e8, appId=0, assignedTeam=null, assignedReader=null, applicationReady=false, score=null, canScore=false, validScore=false, arRecommended=false, eligible2ndRead=false, is2ndRead=false, need3ndRead=false, requiresQC=false] process:Read.bp[id=XXX]

              BEFORE RULEFLOW STARTED process:Read.bp[id=XXX]

              BEFORE PROCESS NODE TRIGGERED node:Start[id=1] process:Read.bp[id=XXX]

              BEFORE PROCESS NODE EXITED node:Start[id=1] process:Read.bp[id=XXX]

              BEFORE PROCESS NODE TRIGGERED node:Score Application[id=6] process:PEfreshmanRead.bp[id=XXX]

              Hibernate: insert into WorkItemInfo (workItemId, creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray) values (null, ?, ?, ?, ?, ?, ?)

              AFTER PROCESS NODE TRIGGERED node:Score Application[id=6] process:Read.bp[id=XXX]

              AFTER PROCESS NODE TRIGGERED node:Start[id=1] process:Read.bp[id=XXX]

              AFTER PROCESS NODE TRIGGERED node:Start[id=1] process:Read.bp[id=XXX]

              AFTER RULEFLOW STARTED process:Read.bp[id=XXX]

              Hibernate: insert into Task (id, allowedToDelegate, taskInitiator_id, priority, activationTime, actualOwner_id, createdBy_id, createdOn, documentAccessType, documentContentId, documentType, expirationTime, faultAccessType, faultContentId, faultName, faultType, outputAccessType, outputContentId, outputType, parentId, previousStatus, processInstanceId, skipable, status, workItemId) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

              Hibernate: insert into I18NText (id, language, text) values (null, ?, ?)

              Hibernate: insert into Content (id, content) values (null, ?)

              Hibernate: update ProcessInstanceInfo set lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?

              Hibernate: update Task set allowedToDelegate=?, taskInitiator_id=?, priority=?, activationTime=?, actualOwner_id=?, createdBy_id=?, createdOn=?, documentAccessType=?, documentContentId=?, documentType=?, expirationTime=?, faultAccessType=?, faultContentId=?, faultName=?, faultType=?, outputAccessType=?, outputContentId=?, outputType=?, parentId=?, previousStatus=?, processInstanceId=?, skipable=?, status=?, workItemId=? where id=?

              Hibernate: update WorkItemInfo set creationDate=?, name=?, processInstanceId=?, state=?, OPTLOCK=?, workItemByteArray=? where workItemId=? and OPTLOCK=?

              Hibernate: update I18NText set Task_Names_Id=? where id=?

              Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

              Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

              Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

              0    14/08 12:33:53,996[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

              insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

              5    14/08 12:33:54,001[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

              insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

              7    14/08 12:33:54,003[NioProcessor-1] ERROR event.def.AbstractFlushingEventListener.performExecutions - 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:71)

                        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

                        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:254)

                        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)

                        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:171)

                        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)

                        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)

                        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1001)

                        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:339)

                        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)

                        at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)

                        at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:820)

                        at org.jbpm.task.service.TaskServiceSession.addTask(TaskServiceSession.java:134)

                        at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:109)

                        at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                        at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)

                        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                        at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:176)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)

                        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                        at java.lang.Thread.run(Thread.java:680)

              Caused by: org.h2.jdbc.JdbcBatchUpdateException: Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

              insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

                        at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1119)

                        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)

                        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)

                        ... 37 more

              javax.persistence.RollbackException: Error while commiting the transaction

                        at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)

                        at org.jbpm.task.service.TaskServiceSession.doOperationInTransaction(TaskServiceSession.java:820)

                        at org.jbpm.task.service.TaskServiceSession.addTask(TaskServiceSession.java:134)

                        at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:109)

                        at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                        at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)

                        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:229)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                        at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:176)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)

                        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                        at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)

                        at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)

                        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                        at java.lang.Thread.run(Thread.java:680)

              Caused by: 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:254)

                        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)

                        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:171)

                        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)

                        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)

                        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1001)

                        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:339)

                        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)

                        at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)

                        ... 29 more

              Caused by: org.h2.jdbc.JdbcBatchUpdateException: Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

              insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

                        at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1119)

                        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)

                        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:247)

                        ... 37 more

              Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

              • 4. Re: TaskService Referential integrity constraint violation
                Mauricio Salatino Master

                Hi there,

                Usually this exception:

                 

                Caused by: org.h2.jdbc.JdbcBatchUpdateException: Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)";

                 

                Makes reference to the "People" that you have loaded in your identity tables. Usually you will see this exceptions when you don't have an Administrator user loaded or some or your processes use an entity that is not loaded in that tables.

                Make sure that you at least have your "Administrator" user loaded. The Task Client allows you to add Users as far as I remember with the addUser() method.

                Cheers

                • 5. Re: TaskService Referential integrity constraint violation
                  Gary Struthers Newbie

                  Hi Mauricio,

                   

                  I've tried adding various users and groups to the TaskServiceSession. If I remove the Administrator

                  Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

                  fails. But with Administrator, it inserts fine and so does a potential owner, but after Session update it doesn't work again.

                   

                  Hibernate: insert into PeopleAssignments_BAs (task_id, entity_id) values (?, ?)

                  Hibernate: insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?)

                  But then it updates the session and that begins the constraint violation

                   

                  Hibernate: update SessionInfo set lastModificationDate=?, rulesByteArray=?, startDate=?, OPTLOCK=? where id=? and OPTLOCK=?

                  0    14/08 12:33:53,996[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

                  insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

                  5    14/08 12:33:54,001[NioProcessor-1] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - Referential integrity constraint violation: "FK1EE418D2C122ED2: PUBLIC.PEOPLEASSIGNMENTS_POTOWNERS FOREIGN KEY(ENTITY_ID) REFERENCES PUBLIC.ORGANIZATIONALENTITY(ID)"; SQL statement:

                  insert into PeopleAssignments_PotOwners (task_id, entity_id) values (?, ?) [23002-128]

                  7    14/08 12:33:54,003[NioProcessor-1] ERROR event.def.AbstractFlushingEventListener.performExecutions - Could not synchronize database state with session

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