3 Replies Latest reply on Jan 28, 2009 6:59 PM by Jan Groth

    TestNG, jBPM and Transactions

    Mike Schulze Newbie


      Hi,

      I have a problem with the testing of my Seam/jBPM-application. The problem is, that my test produces an error ut my app isn't. It all happens during calling the update-method of the Home-Object of my 'TestCustomer'-Entity. The situation is the following:

      There are 3 methods of 2 objects involved. Method m1 of object A calls the methods m2 and m3 of object B. m2 - creates a businessprocess; m3 updates my entity.



      m1:

      public void createProcess(){
           bestellprozessManager.createProcess();
           bestellprozessManager.setPidToCustomer();
      }




      m2:

      @CreateProcess(definition="Bestellprozess_neu")
      @Begin(join=true)
      public void createProcess(){
           Contexts.getBusinessProcessContext().set("order_state", ORDERSTATE_NORMAL);
           log.info("start process...");
      }




      m3:

      public void setPidToCustomer(){
           Long pid = BusinessProcess.instance().getProcessId();
           if (pid != null){
                testCustomer.setPid(pid);
                System.out.println("PersistenceContext is Open: " + TestCustomerHome.getPersistenceContext().isOpen());
           ------>     testCustomerHome.update(); <-----------
                log.info("setze PID im Customer-Objekt: " + BusinessProcess.instance().getProcessId());
           }else{
                   log.info("PID wurde zu 'null' aufgelöst");
           }
           if (testOrder != null){
                log.info("Setze Context-Variable 'bestell_id' " + testOrder.getId());
                ProcessInstance.instance().getContextInstance().setVariable("bestell_id", testOrder.getId());
           }else{
                log.info("testOrder == null - > mal anders beziehen");
           }
      }




      When I run my TestNG-Test the error occurs at the marked codeline. The Stacktrace is:

      INFO  [org.domain.SeamProcessTest.bestellprozess.BestellprozessManager] starte Bestellprozess...
      Hibernate: select top ? processdef0_.ID_ as ID1_8_, processdef0_.NAME_ as NAME3_8_, processdef0_.DESCRIPTION_ as DESCRIPT4_8_, processdef0_.VERSION_ as VERSION5_8_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_8_, processdef0_.STARTSTATE_ as STARTSTATE7_8_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc
      Hibernate: select exceptionh0_.PROCESSDEFINITION_ as PROCESSD5_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.PROCESSDEFINITION_=?
      Hibernate: insert into JBPM_TOKEN (ID_, VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, LOCK_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      Hibernate: call identity()
      Hibernate: insert into JBPM_PROCESSINSTANCE (ID_, VERSION_, KEY_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_) values (null, ?, ?, ?, ?, ?, ?, ?, ?)
      Hibernate: call identity()
      Hibernate: select definition0_.PROCESSDEFINITION_ as PROCESSD4_1_, definition0_.ID_ as ID1_1_, definition0_.NAME_ as NAME3_1_, definition0_.ID_ as ID1_19_0_, definition0_.NAME_ as NAME3_19_0_, definition0_.PROCESSDEFINITION_ as PROCESSD4_19_0_, definition0_.STARTTASK_ as STARTTASK5_19_0_, definition0_.CLASS_ as CLASS2_19_0_ from JBPM_MODULEDEFINITION definition0_ where definition0_.PROCESSDEFINITION_=?
      Hibernate: select events0_.PROCESSDEFINITION_ as PROCESSD5_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.PROCESSDEFINITION_=?
      Hibernate: select node0_.ID_ as ID1_9_0_, node0_.NAME_ as NAME3_9_0_, node0_.DESCRIPTION_ as DESCRIPT4_9_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_9_0_, node0_.ISASYNC_ as ISASYNC6_9_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_9_0_, node0_.ACTION_ as ACTION8_9_0_, node0_.SUPERSTATE_ as SUPERSTATE9_9_0_, node0_.SUBPROCNAME_ as SUBPROC10_9_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_9_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_9_0_, node0_.DECISIONDELEGATION as DECISIO13_9_0_, node0_.SCRIPT_ as SCRIPT14_9_0_, node0_.SIGNAL_ as SIGNAL15_9_0_, node0_.CREATETASKS_ as CREATET16_9_0_, node0_.ENDTASKS_ as ENDTASKS17_9_0_, node0_.CLASS_ as CLASS2_9_0_ from JBPM_NODE node0_ where node0_.ID_=?
      Hibernate: select leavingtra0_.FROM_ as FROM5_1_, leavingtra0_.ID_ as ID1_1_, leavingtra0_.FROMINDEX_ as FROMINDEX8_1_, leavingtra0_.ID_ as ID1_10_0_, leavingtra0_.NAME_ as NAME2_10_0_, leavingtra0_.DESCRIPTION_ as DESCRIPT3_10_0_, leavingtra0_.PROCESSDEFINITION_ as PROCESSD4_10_0_, leavingtra0_.FROM_ as FROM5_10_0_, leavingtra0_.TO_ as TO6_10_0_, leavingtra0_.CONDITION_ as CONDITION7_10_0_ from JBPM_TRANSITION leavingtra0_ where leavingtra0_.FROM_=?
      Hibernate: select exceptionh0_.TRANSITION_ as TRANSITION8_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.TRANSITION_=?
      Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.NODE_=?
      Hibernate: select events0_.TRANSITION_ as TRANSITION7_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.TRANSITION_=?
      Hibernate: select node0_.ID_ as ID1_9_0_, node0_.NAME_ as NAME3_9_0_, node0_.DESCRIPTION_ as DESCRIPT4_9_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_9_0_, node0_.ISASYNC_ as ISASYNC6_9_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_9_0_, node0_.ACTION_ as ACTION8_9_0_, node0_.SUPERSTATE_ as SUPERSTATE9_9_0_, node0_.SUBPROCNAME_ as SUBPROC10_9_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_9_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_9_0_, node0_.DECISIONDELEGATION as DECISIO13_9_0_, node0_.SCRIPT_ as SCRIPT14_9_0_, node0_.SIGNAL_ as SIGNAL15_9_0_, node0_.CREATETASKS_ as CREATET16_9_0_, node0_.ENDTASKS_ as ENDTASKS17_9_0_, node0_.CLASS_ as CLASS2_9_0_ from JBPM_NODE node0_ where node0_.ID_=?
      Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.NODE_=?
      Hibernate: select actions0_.EVENT_ as EVENT9_1_, actions0_.ID_ as ID1_1_, actions0_.EVENTINDEX_ as EVENTINDEX17_1_, actions0_.ID_ as ID1_12_0_, actions0_.NAME_ as NAME3_12_0_, actions0_.ISPROPAGATIONALLOWED_ as ISPROPAG4_12_0_, actions0_.ACTIONEXPRESSION_ as ACTIONEX5_12_0_, actions0_.ISASYNC_ as ISASYNC6_12_0_, actions0_.REFERENCEDACTION_ as REFERENC7_12_0_, actions0_.ACTIONDELEGATION_ as ACTIONDE8_12_0_, actions0_.EVENT_ as EVENT9_12_0_, actions0_.PROCESSDEFINITION_ as PROCESS10_12_0_, actions0_.EXPRESSION_ as EXPRESSION11_12_0_, actions0_.TIMERNAME_ as TIMERNAME12_12_0_, actions0_.DUEDATE_ as DUEDATE13_12_0_, actions0_.REPEAT_ as REPEAT14_12_0_, actions0_.TRANSITIONNAME_ as TRANSIT15_12_0_, actions0_.TIMERACTION_ as TIMERAC16_12_0_, actions0_.class as class12_0_ from JBPM_ACTION actions0_ where actions0_.EVENT_=?
      INFO  [org.domain.SeamProcessTest.bestellprozess.BestellprozessManager] entering Decision-Node
      Hibernate: select leavingtra0_.FROM_ as FROM5_1_, leavingtra0_.ID_ as ID1_1_, leavingtra0_.FROMINDEX_ as FROMINDEX8_1_, leavingtra0_.ID_ as ID1_10_0_, leavingtra0_.NAME_ as NAME2_10_0_, leavingtra0_.DESCRIPTION_ as DESCRIPT3_10_0_, leavingtra0_.PROCESSDEFINITION_ as PROCESSD4_10_0_, leavingtra0_.FROM_ as FROM5_10_0_, leavingtra0_.TO_ as TO6_10_0_, leavingtra0_.CONDITION_ as CONDITION7_10_0_ from JBPM_TRANSITION leavingtra0_ where leavingtra0_.FROM_=?
      Hibernate: select exceptionh0_.TRANSITION_ as TRANSITION8_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.TRANSITION_=?
      Hibernate: select exceptionh0_.TRANSITION_ as TRANSITION8_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.TRANSITION_=?
      Hibernate: select events0_.TRANSITION_ as TRANSITION7_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.TRANSITION_=?
      Hibernate: select node0_.ID_ as ID1_9_0_, node0_.NAME_ as NAME3_9_0_, node0_.DESCRIPTION_ as DESCRIPT4_9_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_9_0_, node0_.ISASYNC_ as ISASYNC6_9_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_9_0_, node0_.ACTION_ as ACTION8_9_0_, node0_.SUPERSTATE_ as SUPERSTATE9_9_0_, node0_.SUBPROCNAME_ as SUBPROC10_9_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_9_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_9_0_, node0_.DECISIONDELEGATION as DECISIO13_9_0_, node0_.SCRIPT_ as SCRIPT14_9_0_, node0_.SIGNAL_ as SIGNAL15_9_0_, node0_.CREATETASKS_ as CREATET16_9_0_, node0_.ENDTASKS_ as ENDTASKS17_9_0_, node0_.CLASS_ as CLASS2_9_0_ from JBPM_NODE node0_ where node0_.ID_=?
      Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.NODE_=?
      Hibernate: select actions0_.EVENT_ as EVENT9_1_, actions0_.ID_ as ID1_1_, actions0_.EVENTINDEX_ as EVENTINDEX17_1_, actions0_.ID_ as ID1_12_0_, actions0_.NAME_ as NAME3_12_0_, actions0_.ISPROPAGATIONALLOWED_ as ISPROPAG4_12_0_, actions0_.ACTIONEXPRESSION_ as ACTIONEX5_12_0_, actions0_.ISASYNC_ as ISASYNC6_12_0_, actions0_.REFERENCEDACTION_ as REFERENC7_12_0_, actions0_.ACTIONDELEGATION_ as ACTIONDE8_12_0_, actions0_.EVENT_ as EVENT9_12_0_, actions0_.PROCESSDEFINITION_ as PROCESS10_12_0_, actions0_.EXPRESSION_ as EXPRESSION11_12_0_, actions0_.TIMERNAME_ as TIMERNAME12_12_0_, actions0_.DUEDATE_ as DUEDATE13_12_0_, actions0_.REPEAT_ as REPEAT14_12_0_, actions0_.TRANSITIONNAME_ as TRANSIT15_12_0_, actions0_.TIMERACTION_ as TIMERAC16_12_0_, actions0_.class as class12_0_ from JBPM_ACTION actions0_ where actions0_.EVENT_=?
      INFO  [org.domain.SeamProcessTest.bestellprozess.BestellprozessManager] entering State-Node
      PersistenceContext is Open: true
      Hibernate: insert into JBPM_MODULEINSTANCE (ID_, VERSION_, PROCESSINSTANCE_, TASKMGMTDEFINITION_, CLASS_) values (null, ?, ?, ?, 'T')
      ERROR [org.hibernate.util.JDBCExceptionReporter] Integrity constraint violation - no parent FK_MODINST_PRCINST table: JBPM_PROCESSINSTANCE in statement [insert into JBPM_MODULEINSTANCE (ID_, VERSION_, PROCESSINSTANCE_, TASKMGMTDEFINITION_, CLASS_) values (null, ?, ?, ?, 'T')]
      ERROR [org.jboss.seam.transaction.SynchronizationRegistry] Exception processing transaction Synchronization before completion
      org.hibernate.exception.ConstraintViolationException: could not insert: [org.jbpm.taskmgmt.exe.TaskMgmtInstance]
           at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
           at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
           at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
           at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
           at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
           at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
           at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
           at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
           at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
           at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
           at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
           at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
           at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
           at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
           at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
           at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
           at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)
           at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
           at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
           at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
           at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
           at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
           at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
           at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
           at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
           at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
           at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
           at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
           at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
           at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
           at org.jboss.seam.bpm.ManagedJbpmContext.beforeCompletion(ManagedJbpmContext.java:116)
           at org.jboss.seam.transaction.SynchronizationRegistry.beforeTransactionCompletion(SynchronizationRegistry.java:62)
           at org.jboss.seam.transaction.SeSynchronizations.beforeTransactionCommit(SeSynchronizations.java:50)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:49)
           at org.jboss.seam.util.Work.workInTransaction(Work.java:52)
           at org.jboss.seam.bpm.ProcessInstance.getProcessInstance(ProcessInstance.java:39)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2092)
           at org.jboss.seam.Component.unwrap(Component.java:2118)
           at org.jboss.seam.Component.getInstance(Component.java:1890)
           at org.jboss.seam.Component.getInstance(Component.java:1855)
           at org.jboss.seam.Component.getInstance(Component.java:1832)
           at org.jboss.seam.Component.getInstance(Component.java:1827)
           at org.jboss.seam.bpm.ProcessInstance.instance(ProcessInstance.java:65)
           at org.jboss.seam.bpm.BusinessProcess.hasActiveProcess(BusinessProcess.java:62)
           at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:347)
           at org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:112)
           at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:550)
           at org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest.testCreateProcess(BestellprozessControllerTest.java:192)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
           at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
           at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
           at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
           at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
           at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
           at org.testng.TestRunner.runWorkers(TestRunner.java:712)
           at org.testng.TestRunner.privateRun(TestRunner.java:582)
           at org.testng.TestRunner.run(TestRunner.java:477)
           at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
           at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
           at org.testng.SuiteRunner.run(SuiteRunner.java:198)
           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823)
           at org.testng.TestNG.runSuitesLocally(TestNG.java:790)
           at org.testng.TestNG.run(TestNG.java:708)
           at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
           at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
      Caused by: java.sql.SQLException: Integrity constraint violation - no parent FK_MODINST_PRCINST table: JBPM_PROCESSINSTANCE in statement [insert into JBPM_MODULEINSTANCE (ID_, VERSION_, PROCESSINSTANCE_, TASKMGMTDEFINITION_, CLASS_) values (null, ?, ?, ?, 'T')]
           at org.hsqldb.jdbc.Util.throwError(Unknown Source)
           at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
           at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
           at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:250)
           at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
           ... 73 more




      When I run the same method in my dev-Environment nothing happens. As you can see the only difference is that the customer is persisted.

      10:42:48,437 INFO  [STDOUT] Hibernate: select top ? processdef0_.ID_ as ID1_8_, processdef0_.NAME_ as NAME3_8_, processdef0_.DESCRIPTION_ as DESCRIPT4_8_, processdef0_.VERSION_ as VERSION5_8_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN6_8_, processdef0_.STARTSTATE_ as STARTSTATE7_8_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc
      10:42:48,484 INFO  [STDOUT] Hibernate: select exceptionh0_.PROCESSDEFINITION_ as PROCESSD5_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.PROCESSDEFINITION_=?
      10:42:48,515 INFO  [STDOUT] Hibernate: insert into JBPM_TOKEN (ID_, VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, LOCK_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      10:42:48,515 INFO  [STDOUT] Hibernate: call identity()
      10:42:48,515 INFO  [STDOUT] Hibernate: insert into JBPM_PROCESSINSTANCE (ID_, VERSION_, KEY_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_) values (null, ?, ?, ?, ?, ?, ?, ?, ?)
      10:42:48,515 INFO  [STDOUT] Hibernate: call identity()
      10:42:48,515 INFO  [STDOUT] Hibernate: select definition0_.PROCESSDEFINITION_ as PROCESSD4_1_, definition0_.ID_ as ID1_1_, definition0_.NAME_ as NAME3_1_, definition0_.ID_ as ID1_19_0_, definition0_.NAME_ as NAME3_19_0_, definition0_.PROCESSDEFINITION_ as PROCESSD4_19_0_, definition0_.STARTTASK_ as STARTTASK5_19_0_, definition0_.CLASS_ as CLASS2_19_0_ from JBPM_MODULEDEFINITION definition0_ where definition0_.PROCESSDEFINITION_=?
      10:42:48,531 INFO  [STDOUT] Hibernate: select events0_.PROCESSDEFINITION_ as PROCESSD5_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.PROCESSDEFINITION_=?
      10:42:48,531 INFO  [STDOUT] Hibernate: select node0_.ID_ as ID1_9_0_, node0_.NAME_ as NAME3_9_0_, node0_.DESCRIPTION_ as DESCRIPT4_9_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_9_0_, node0_.ISASYNC_ as ISASYNC6_9_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_9_0_, node0_.ACTION_ as ACTION8_9_0_, node0_.SUPERSTATE_ as SUPERSTATE9_9_0_, node0_.SUBPROCNAME_ as SUBPROC10_9_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_9_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_9_0_, node0_.DECISIONDELEGATION as DECISIO13_9_0_, node0_.SCRIPT_ as SCRIPT14_9_0_, node0_.SIGNAL_ as SIGNAL15_9_0_, node0_.CREATETASKS_ as CREATET16_9_0_, node0_.ENDTASKS_ as ENDTASKS17_9_0_, node0_.CLASS_ as CLASS2_9_0_ from JBPM_NODE node0_ where node0_.ID_=?
      10:42:48,687 INFO  [STDOUT] Hibernate: select leavingtra0_.FROM_ as FROM5_1_, leavingtra0_.ID_ as ID1_1_, leavingtra0_.FROMINDEX_ as FROMINDEX8_1_, leavingtra0_.ID_ as ID1_10_0_, leavingtra0_.NAME_ as NAME2_10_0_, leavingtra0_.DESCRIPTION_ as DESCRIPT3_10_0_, leavingtra0_.PROCESSDEFINITION_ as PROCESSD4_10_0_, leavingtra0_.FROM_ as FROM5_10_0_, leavingtra0_.TO_ as TO6_10_0_, leavingtra0_.CONDITION_ as CONDITION7_10_0_ from JBPM_TRANSITION leavingtra0_ where leavingtra0_.FROM_=?
      10:42:48,703 INFO  [STDOUT] Hibernate: select exceptionh0_.TRANSITION_ as TRANSITION8_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.TRANSITION_=?
      10:42:48,703 INFO  [STDOUT] Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.NODE_=?
      10:42:48,703 INFO  [STDOUT] Hibernate: select events0_.TRANSITION_ as TRANSITION7_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.TRANSITION_=?
      10:42:48,718 INFO  [STDOUT] Hibernate: select node0_.ID_ as ID1_9_0_, node0_.NAME_ as NAME3_9_0_, node0_.DESCRIPTION_ as DESCRIPT4_9_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_9_0_, node0_.ISASYNC_ as ISASYNC6_9_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_9_0_, node0_.ACTION_ as ACTION8_9_0_, node0_.SUPERSTATE_ as SUPERSTATE9_9_0_, node0_.SUBPROCNAME_ as SUBPROC10_9_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_9_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_9_0_, node0_.DECISIONDELEGATION as DECISIO13_9_0_, node0_.SCRIPT_ as SCRIPT14_9_0_, node0_.SIGNAL_ as SIGNAL15_9_0_, node0_.CREATETASKS_ as CREATET16_9_0_, node0_.ENDTASKS_ as ENDTASKS17_9_0_, node0_.CLASS_ as CLASS2_9_0_ from JBPM_NODE node0_ where node0_.ID_=?
      10:42:48,718 INFO  [STDOUT] Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.NODE_=?
      10:42:48,718 WARN  [ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.Decision - this operation breaks ==
      10:42:48,718 INFO  [STDOUT] Hibernate: select actions0_.EVENT_ as EVENT9_1_, actions0_.ID_ as ID1_1_, actions0_.EVENTINDEX_ as EVENTINDEX17_1_, actions0_.ID_ as ID1_12_0_, actions0_.NAME_ as NAME3_12_0_, actions0_.ISPROPAGATIONALLOWED_ as ISPROPAG4_12_0_, actions0_.ACTIONEXPRESSION_ as ACTIONEX5_12_0_, actions0_.ISASYNC_ as ISASYNC6_12_0_, actions0_.REFERENCEDACTION_ as REFERENC7_12_0_, actions0_.ACTIONDELEGATION_ as ACTIONDE8_12_0_, actions0_.EVENT_ as EVENT9_12_0_, actions0_.PROCESSDEFINITION_ as PROCESS10_12_0_, actions0_.EXPRESSION_ as EXPRESSION11_12_0_, actions0_.TIMERNAME_ as TIMERNAME12_12_0_, actions0_.DUEDATE_ as DUEDATE13_12_0_, actions0_.REPEAT_ as REPEAT14_12_0_, actions0_.TRANSITIONNAME_ as TRANSIT15_12_0_, actions0_.TIMERACTION_ as TIMERAC16_12_0_, actions0_.class as class12_0_ from JBPM_ACTION actions0_ where actions0_.EVENT_=?
      10:42:48,734 INFO  [BestellprozessManager] entering Decision-Node
      10:42:48,734 INFO  [STDOUT] Hibernate: select leavingtra0_.FROM_ as FROM5_1_, leavingtra0_.ID_ as ID1_1_, leavingtra0_.FROMINDEX_ as FROMINDEX8_1_, leavingtra0_.ID_ as ID1_10_0_, leavingtra0_.NAME_ as NAME2_10_0_, leavingtra0_.DESCRIPTION_ as DESCRIPT3_10_0_, leavingtra0_.PROCESSDEFINITION_ as PROCESSD4_10_0_, leavingtra0_.FROM_ as FROM5_10_0_, leavingtra0_.TO_ as TO6_10_0_, leavingtra0_.CONDITION_ as CONDITION7_10_0_ from JBPM_TRANSITION leavingtra0_ where leavingtra0_.FROM_=?
      10:42:48,734 INFO  [STDOUT] Hibernate: select exceptionh0_.TRANSITION_ as TRANSITION8_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.TRANSITION_=?
      10:42:48,734 INFO  [STDOUT] Hibernate: select exceptionh0_.TRANSITION_ as TRANSITION8_1_, exceptionh0_.ID_ as ID1_1_, exceptionh0_.GRAPHELEMENTINDEX_ as GRAPHELE6_1_, exceptionh0_.ID_ as ID1_13_0_, exceptionh0_.EXCEPTIONCLASSNAME_ as EXCEPTIO2_13_0_, exceptionh0_.TYPE_ as TYPE3_13_0_, exceptionh0_.GRAPHELEMENT_ as GRAPHELE4_13_0_ from JBPM_EXCEPTIONHANDLER exceptionh0_ where exceptionh0_.TRANSITION_=?
      10:42:48,750 INFO  [STDOUT] Hibernate: select events0_.TRANSITION_ as TRANSITION7_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.TRANSITION_=?
      10:42:48,750 INFO  [STDOUT] Hibernate: select node0_.ID_ as ID1_9_0_, node0_.NAME_ as NAME3_9_0_, node0_.DESCRIPTION_ as DESCRIPT4_9_0_, node0_.PROCESSDEFINITION_ as PROCESSD5_9_0_, node0_.ISASYNC_ as ISASYNC6_9_0_, node0_.ISASYNCEXCL_ as ISASYNCE7_9_0_, node0_.ACTION_ as ACTION8_9_0_, node0_.SUPERSTATE_ as SUPERSTATE9_9_0_, node0_.SUBPROCNAME_ as SUBPROC10_9_0_, node0_.SUBPROCESSDEFINITION_ as SUBPROC11_9_0_, node0_.DECISIONEXPRESSION_ as DECISIO12_9_0_, node0_.DECISIONDELEGATION as DECISIO13_9_0_, node0_.SCRIPT_ as SCRIPT14_9_0_, node0_.SIGNAL_ as SIGNAL15_9_0_, node0_.CREATETASKS_ as CREATET16_9_0_, node0_.ENDTASKS_ as ENDTASKS17_9_0_, node0_.CLASS_ as CLASS2_9_0_ from JBPM_NODE node0_ where node0_.ID_=?
      10:42:48,750 INFO  [STDOUT] Hibernate: select events0_.NODE_ as NODE6_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_11_0_, events0_.EVENTTYPE_ as EVENTTYPE2_11_0_, events0_.TYPE_ as TYPE3_11_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_11_0_ from JBPM_EVENT events0_ where events0_.NODE_=?
      10:42:48,750 WARN  [ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.State - this operation breaks ==
      10:42:48,750 INFO  [STDOUT] Hibernate: select actions0_.EVENT_ as EVENT9_1_, actions0_.ID_ as ID1_1_, actions0_.EVENTINDEX_ as EVENTINDEX17_1_, actions0_.ID_ as ID1_12_0_, actions0_.NAME_ as NAME3_12_0_, actions0_.ISPROPAGATIONALLOWED_ as ISPROPAG4_12_0_, actions0_.ACTIONEXPRESSION_ as ACTIONEX5_12_0_, actions0_.ISASYNC_ as ISASYNC6_12_0_, actions0_.REFERENCEDACTION_ as REFERENC7_12_0_, actions0_.ACTIONDELEGATION_ as ACTIONDE8_12_0_, actions0_.EVENT_ as EVENT9_12_0_, actions0_.PROCESSDEFINITION_ as PROCESS10_12_0_, actions0_.EXPRESSION_ as EXPRESSION11_12_0_, actions0_.TIMERNAME_ as TIMERNAME12_12_0_, actions0_.DUEDATE_ as DUEDATE13_12_0_, actions0_.REPEAT_ as REPEAT14_12_0_, actions0_.TRANSITIONNAME_ as TRANSIT15_12_0_, actions0_.TIMERACTION_ as TIMERAC16_12_0_, actions0_.class as class12_0_ from JBPM_ACTION actions0_ where actions0_.EVENT_=?
      10:42:48,765 INFO  [BestellprozessManager] entering State-Node
      10:42:53,125 INFO  [STDOUT] Hibernate: select top ? job0_.ID_ as ID1_30_, job0_.VERSION_ as VERSION3_30_, job0_.DUEDATE_ as DUEDATE4_30_, job0_.PROCESSINSTANCE_ as PROCESSI5_30_, job0_.TOKEN_ as TOKEN6_30_, job0_.TASKINSTANCE_ as TASKINST7_30_, job0_.ISSUSPENDED_ as ISSUSPEN8_30_, job0_.ISEXCLUSIVE_ as ISEXCLUS9_30_, job0_.LOCKOWNER_ as LOCKOWNER10_30_, job0_.LOCKTIME_ as LOCKTIME11_30_, job0_.EXCEPTION_ as EXCEPTION12_30_, job0_.RETRIES_ as RETRIES13_30_, job0_.NAME_ as NAME14_30_, job0_.REPEAT_ as REPEAT15_30_, job0_.TRANSITIONNAME_ as TRANSIT16_30_, job0_.ACTION_ as ACTION17_30_, job0_.GRAPHELEMENTTYPE_ as GRAPHEL18_30_, job0_.GRAPHELEMENT_ as GRAPHEL19_30_, job0_.NODE_ as NODE20_30_, job0_.CLASS_ as CLASS2_30_ from JBPM_JOB job0_ where (job0_.LOCKOWNER_ is null or job0_.LOCKOWNER_=?) and job0_.RETRIES_>0 and job0_.DUEDATE_<=? and job0_.ISSUSPENDED_<>1 order by job0_.DUEDATE_ asc
      10:42:53,125 INFO  [STDOUT] Hibernate: select top ? job0_.ID_ as ID1_30_, job0_.VERSION_ as VERSION3_30_, job0_.DUEDATE_ as DUEDATE4_30_, job0_.PROCESSINSTANCE_ as PROCESSI5_30_, job0_.TOKEN_ as TOKEN6_30_, job0_.TASKINSTANCE_ as TASKINST7_30_, job0_.ISSUSPENDED_ as ISSUSPEN8_30_, job0_.ISEXCLUSIVE_ as ISEXCLUS9_30_, job0_.LOCKOWNER_ as LOCKOWNER10_30_, job0_.LOCKTIME_ as LOCKTIME11_30_, job0_.EXCEPTION_ as EXCEPTION12_30_, job0_.RETRIES_ as RETRIES13_30_, job0_.NAME_ as NAME14_30_, job0_.REPEAT_ as REPEAT15_30_, job0_.TRANSITIONNAME_ as TRANSIT16_30_, job0_.ACTION_ as ACTION17_30_, job0_.GRAPHELEMENTTYPE_ as GRAPHEL18_30_, job0_.GRAPHELEMENT_ as GRAPHEL19_30_, job0_.NODE_ as NODE20_30_, job0_.CLASS_ as CLASS2_30_ from JBPM_JOB job0_ where (job0_.LOCKOWNER_ is null or job0_.LOCKOWNER_=?) and job0_.RETRIES_>0 and job0_.ISSUSPENDED_<>1 order by job0_.DUEDATE_ asc
      10:42:57,968 INFO  [STDOUT] PersistenceContext is Open: true
      10:42:58,031 INFO  [STDOUT] Hibernate: 
          update
              TestCustomer 
          set
              name=?,
              version=?,
              identified=?,
              pid=? 
          where
              id=? 
              and version=?




      My Configuration:

      - Seam 2.0.2SP1

      - jBPM 3.2.3

      - JBoss 4.2.2

      My Project was build with JBoss-Tools, therefore i use the created test-project with TestNG and Embedded JBoss.


      Does anybody have a clue why this different behaviour occurs? Is it possible that the embedded JBoss is not able to handle the transactions in the same way JBoss does? If that is the case - how can i test my application in combination with my businessprocess in seam?

      Thx - Mike


        • 1. Re: TestNG, jBPM and Transactions
          Mike Schulze Newbie


          I could narrow the problem to contains-method of the AbstractEntityManagerImpl-object. It catches an Exception after the EntityManagerProxy calls in its flush-method the flush-method of the AbstractEntityManagerImpl-object.

          To clarify the problem, I created a new Helper-class to make sure, that the problem is not in my code. A new method to update my Customer is:



          @In (create=true) TestCustomerHome testCustomerHome;
          
          public void update(){
               testCustomerHome.clearInstance();                                                                                     
               testCustomerHome.setId(15l);
               TestCustomer customer = testCustomerHome.getInstance();                                                                                
               customer.setName("Max");          
               testCustomerHome.setInstance(customer);
               System.out.println("################Name editiert:" + customer.getName());
               testCustomerHome.update();
               System.out.println("done");
          }




          The corresponding stacktrace (which is produced by the same exception) is:



          DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 5002158889984000
          DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
          DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] No JTA transaction found
          DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
          DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
          DEBUG [org.hibernate.loader.Loader] loading entity: [org.domain.SeamProcessTest.entity.TestCustomer#15]
          DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
          DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
          DEBUG [org.hibernate.SQL] 
              select
                  testcustom0_.id as id0_0_,
                  testcustom0_.identified as identified0_0_,
                  testcustom0_.name as name0_0_,
                  testcustom0_.pid as pid0_0_,
                  testcustom0_.version as version0_0_ 
              from
                  TestCustomer testcustom0_ 
              where
                  testcustom0_.id=?
          Hibernate: 
              select
                  testcustom0_.id as id0_0_,
                  testcustom0_.identified as identified0_0_,
                  testcustom0_.name as name0_0_,
                  testcustom0_.pid as pid0_0_,
                  testcustom0_.version as version0_0_ 
              from
                  TestCustomer testcustom0_ 
              where
                  testcustom0_.id=?
          DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
          DEBUG [org.hibernate.loader.Loader] result row: EntityKey[org.domain.SeamProcessTest.entity.TestCustomer#15]
          DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
          DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
          DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
          DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
          DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [org.domain.SeamProcessTest.entity.TestCustomer#15]
          DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [org.domain.SeamProcessTest.entity.TestCustomer#15]
          DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
          DEBUG [org.hibernate.loader.Loader] done entity load
          DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
          DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
          DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
          DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
          DEBUG [org.hibernate.pretty.Printer] listing entities:
          DEBUG [org.hibernate.pretty.Printer] org.domain.SeamProcessTest.entity.TestCustomer{identified=false, pid=-1, name=Mustermann, id=15, version=null}
          DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
          ################Name editiert:Max
          [Invoker 13736904]         Keeping method org.jboss.seam.mock.DBUnitSeamTest.end() for class [TestClass class org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest]
          [Invoker 13736904] Invoking @AfterMethod org.jboss.seam.mock.DBUnitSeamTest.end()
          [Invoker 13736904]         Keeping method org.jboss.seam.mock.SeamTest.cleanup() for class [TestClass class org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest]
          [Invoker 13736904] Invoking @AfterClass org.jboss.seam.mock.SeamTest.cleanup()
          INFO  [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.
          INFO  [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.
          INFO  [org.quartz.core.QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.
          
          *********** INVOKED METHODS
          
               org.jboss.seam.mock.SeamTest.init() 18926678
               org.jboss.seam.mock.DBUnitSeamTest.setDatasourceJndiName(java.lang.String)java:/SeamProcessTestDatasource  18926678
               org.jboss.seam.mock.DBUnitSeamTest.setupClass() 18926678
               org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest.initialize() 18926678
                    org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest.testUpdater() 18926678
               org.jboss.seam.mock.SeamTest.cleanup() 18926678
          
          ***********
          
          Creating C:\jbpm_workspace\SeamProcessTest-test\test-output\BestellprozessTest\TestBestellController.html
          FAILED: testUpdater
          javax.persistence.TransactionRequiredException: no transaction is in progress
               at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:294)
               at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:90)
               at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.flush(FullTextEntityManagerImpl.java:102)
               at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:90)
               at org.jboss.seam.framework.EntityHome.update(EntityHome.java:64)
               at org.domain.SeamProcessTest.session.TestCustomerHome.update(TestCustomerHome.java:42)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
               at org.jboss.seam.util.Work.workInTransaction(Work.java:41)
               at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
               at org.domain.SeamProcessTest.session.TestCustomerHome_$$_javassist_1.update(TestCustomerHome_$$_javassist_1.java)
               at org.domain.SeamProcessTest.bestellprozess.Updater.update(Updater.java:20)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
               at org.domain.SeamProcessTest.bestellprozess.Updater_$$_javassist_0.update(Updater_$$_javassist_0.java)
               at org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest$2.testComponents(BestellprozessControllerTest.java:159)
               at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:169)
               at org.domain.SeamProcessTest.bestellprozess.BestellprozessControllerTest.testUpdater(BestellprozessControllerTest.java:163)
          ... Removed 30 stack frames




          • 2. Re: TestNG, jBPM and Transactions
            Mike Schulze Newbie

            I found the error. The Exception was thrown, because in my EntityHome-class I had overwritten the update-method in the following way:


            @Override
            public String update() {
                 return super.update();
            }




            Also there was in my Entity an attribute annotated with @version for optimistic logging. I had to remove both entries and after that test worked.

            Does anybody know why this happend? How do those settings interfere with the transaction-handling in embedded-JBoss?


            Thx - Mike

            • 3. Re: TestNG, jBPM and Transactions
              Jan Groth Novice

              good work buddy,


              thanks :-)