0 Replies Latest reply on Jan 14, 2009 6:51 AM by rodosa

    bject references an unsaved transient instance - save the tr

    rodosa

      Hello, I've a problem in a method that advance in a definition process for the indicated transition. The method is the following:

      private void goTo(Long id_instance, String transition) {
       try {
       ProcessInstance instance=getJbpmContext().loadProcessInstanceForUpdate(id_instance);
       if(!instance.isTerminatedImplicitly()){
       Token token=new Token(instance);
       token.signal(transition);
      
       jbpmContext.save(token);
       jbpmContext.save(instance);
       }
       } catch (RuntimeException e) {
       e.printStackTrace();
       }finally{
       jbpmContext.close();
       }
       }
      


      And the exception is.

      12:40:42,078 ERROR [DbPersistenceService] hibernate commit failed
      org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.exe.Token
       at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
       at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
       at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:242)
       at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:597)
       at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3123)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:479)
       at
      ....
      


      How could do I fix it?? Because I save both, token and instance. I tried only to save the instance but it didn't work.

      Thanks