This content has been marked as final.
Show 5 replies
-
1. Re: How to retirieve Hibernate Session object in jBpm 4.0 CR
jbarrez Jun 10, 2009 7:27 AM (in response to ahmy)You can use the following construction:
Environment.getFromCurrent(Session.class)
-
2. Re: How to retirieve Hibernate Session object in jBpm 4.0 CR
ahmy Jun 11, 2009 12:12 AM (in response to ahmy)Hello,
When I run the above code , I got the following exceptionException in thread "main" org.jbpm.api.JbpmException: no environment to get org.hibernate.Session at org.jbpm.api.env.Environment.getFromCurrent(Environment.java:196) at org.jbpm.api.env.Environment.getFromCurrent(Environment.java:189) at ae.emiratesid.bpm.demos.HistoryServiceTest.main(HistoryServiceTest.java:96)
-
3. Re: How to retirieve Hibernate Session object in jBpm 4.0 CR
jbarrez Jun 11, 2009 5:31 AM (in response to ahmy)I assumed you were calling this methdo from within a delegation from your process ... where do you want to use this method?
-
4. Re: How to retirieve Hibernate Session object in jBpm 4.0 CR
ahmy Jun 11, 2009 5:46 AM (in response to ahmy)I want to use the method from a java client , the same place where I get a ProcessEngine instance
-
5. Re: How to retirieve Hibernate Session object in jBpm 4.0 CR
jbarrez Jun 11, 2009 11:41 AM (in response to ahmy)It is logical you can't find the current Hibernate Session, since there is none. A hibernate session is only open during a jbpm operation and is closed afterwards.
So I guess that basically what you want is access to the same SessionFactory as the one that is used by jBPM, which you can get through the processEngine in the same construct as the one I pasted above:processEngine.get(Sessionfactory.class)