JBoss Community

Re: Get hibernate session for own query

created by Heiko Tappe in jBPM - View the full discussion

The following code seems to work for me:

 

EnvironmentImpl environment = EnvironmentImpl.getCurrent();

if (environment == null) {

     environment = ((EnvironmentFactory) processEngine).openEnvironment();

}

Session session = environment.get(Session.class);

 

 

But is this the way to go? If so, do I have to care about "closing" the environment?

 

--Heiko

Reply to this message by going to Community

Start a new discussion in jBPM at Community