[jboss-user] [JBoss jBPM] - Re: A timer associated to a process instance ?

biggef do-not-reply at jboss.com
Tue Aug 1 12:06:01 EDT 2006


Well thanks. 
I followed the example of code in CreateTimerAction and CancelTimerAction (and switched from jbpm 3.0.2 to 3.1.2) and now I can see my timers in the DB. But when I try to set an Action to be called when the timer fires, I got an error.

Here is my related code:
anonymous wrote : Action timerAction = new Action();
  | Delegation delegation = new Delegation();
  | delegation.setClassName("logique.alerte.TimerHandler"); 
  | timerAction.setActionDelegation(delegation);
  | String sDueDate = "5 minutes";
  | String sTimerName = "bob";
  | Date dDueDate = businessCalendar.add( new Date(), duration );
  | 
  | Timer timer = new Timer(executionContext.getToken());
  | timer.setName(sTimerName);
  | timer.setDueDate(dDueDate);
  | timer.setAction(timerAction);
  | timer.setGraphElement(executionContext.getEventSource());
  | 
  | SchedulerService schedulerService = (SchedulerService) Services.getCurrentService(Services.SERVICENAME_SCHEDULER);
  | schedulerService.createTimer(timer);

And here is the error:
anonymous wrote : org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
  |         at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:172)
  |         at org.jbpm.svc.Services.close(Services.java:211)
  |         at org.jbpm.JbpmContext.close(JbpmContext.java:139)
  |         at logique.JbpmManager.closeSession(JbpmManager.java:36)
  |         at servlet.NouveauDossier.postRequest(NouveauDossier.java:94)
  |         at logique.servlet.ServletContenu.traiterRequete(ServletContenu.java:132)
  |         at logique.servlet.ServletContenu.doPost(ServletContenu.java:163)
  |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
  |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  |         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  |         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at logique.ihm.XsltFilter.doFilter(XsltFilter.java:81)
  |         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  |         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
  |         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  |         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  |         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
  |         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  |         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  |         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  |         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  |         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  |         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
  |         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
  |         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
  |         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
  |         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
  |         at java.lang.Thread.run(Thread.java:595)
  | Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.def.Action
  |         at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
  |         at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
  |         at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
  |         at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
  |         at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2785)
  |         at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:457)
  |         at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:180)
  |         at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:104)
  |         at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
  |         at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
  |         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
  |         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:877)
  |         at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:344)
  |         at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
  |         at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:162)
  |         ... 28 more
So how can I save the Action before closing the session ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962234#3962234

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962234



More information about the jboss-user mailing list