This content has been marked as final.
Show 6 replies
-
1. Re: Best Practice to get SessionFactory
boercher Apr 6, 2009 5:23 AM (in response to toriton)Looking at the current jBPM3 code
JbpmContext.getCurrentJbpmContext().getSessionFactory()
seems to be the standard way to access the SessionFactory. In my ActionHandlers I'm rather using the current Session directly viaexecutionContext.getJbpmContext().getSession()
Volker -
2. Re: Best Practice to get SessionFactory
toriton Apr 6, 2009 5:25 AM (in response to toriton)thank for yout reply :)
I do the same in an ActionHandler. -
3. Re: Best Practice to get SessionFactory
toriton Apr 16, 2009 4:01 AM (in response to toriton)Hi all again :),
i found another way to get SessionFactory, and i want know if this is a most clear solution.
I use this code in a DAO class.
JtaDbPersistenceServiceFactory jtaDBFactory = (JtaDbPersistenceServiceFactory)JbpmConfiguration.getInstance().getServiceFactory("persistence");
It is correct?.
It's work fine :) and save correctly.
Thanks for any reply. -
4. Re: Best Practice to get SessionFactory
toriton Apr 16, 2009 4:03 AM (in response to toriton)Sorry bad cut :)
this is how the SessionFactory is returned :
JtaDbPersistenceServiceFactory jtaDBFactory = (JtaDbPersistenceServiceFactory)JbpmConfiguration.getInstance().getServiceFactory("persistence");
return (SessionFactory) jtaDBFactory.getSessionFactory(); -
5. Re: Best Practice to get SessionFactory
kukeltje Apr 16, 2009 7:32 AM (in response to toriton)this way you are dependent on what is explicitly configured (not using interfaces but and explicit implementation) imo that is not the best way (no examples show this, but do show what Volker advised)
-
6. Re: Best Practice to get SessionFactory
toriton Apr 16, 2009 8:22 AM (in response to toriton)Is true, Kuke thanks for your reply. I missed that thing.. usually i use always Interfaces.. my bad to think about this as a solution :).