AnsweredAssumed Answered

Set Hibernate Session as Process Variable

Question asked by golden_boy_t on Dec 31, 2014
Latest reply on Dec 31, 2014 by golden_boy_t
Hi
I Need Open Hibernate Session in one Service Task and close it in end of process. So how can i do this? Can I Set the session As a Process Variable in first "Service Task" and get it in second "Service Task" ? Something like this

public class ServiceTask1 implements JavaDelegate
{
   @Override
   public void execute(DelegateExecution arg0) throws Exception
   {
                      ….
                     arg0.setVariable("myVar", session);
                     …
   }
}
———————————————————————————-
public class ServiceTask2 implements JavaDelegate
{
   @Override
   public void execute(DelegateExecution arg0) throws Exception
   {
                      ….
                     ((Session)arg0.getVariable("myVar")).close();
                     …
   }
}

Best Regards

Outcomes