6 Replies Latest reply on Apr 16, 2009 8:22 AM by Stefano Ferrante

    Best Practice to get SessionFactory

    Stefano Ferrante Newbie

      Hi all , i have a question on how to get SessionFactory directly from JBPM.
      In the documentation
      http://docs.jboss.org/jbpm/v3/userguide/persistence.html#thehibernatesessionfactory
      (par 7.7) In the documentation there is a suggestion to use the JBPM SessionFactory ,for own persistence classes.
      But my question is: which the best practice is to retrieve the SessionFactory?

      I use this code:

      JbpmConfiguration.getInstance().getCurrentJbpmContext().getSessionFactory();
      

      in a DAO class, but i seen around that the method
      getCurrentJbpmContext() will be deprecated, but in my version 3.3.1 is not. So there is another way to interact with shared sessionfactory? or according to my version (3.3.1 GA), this is the only way?
      The DAO class are deployed as Jar with entity classes under the path jbpm-service.sar , and work perfectly at this moment :).


      T.