Hello,
I'm developing a 2-tier Rich-Client Application with Hibernate 3.2 and Eclipse 3.2.1 RCP Framework.
Today I have read a lot about the Thread-Local Session Patterns which is used under my RCP Java SE Environment. So my first design of Business Objects and Data Access Objects was the following:
1) I have a global EntityManagerFactory, where I get my EntityManagers from
2) My Business Objects request a EntityManager from my EntityManagerFactory
3) My Business Objects open and close the Transactions as they are needed with EntityManager.getTransaction.begin()
4) My Business Objects call my DAOs, which make the operations with the database, for example EntityManager.persists(record) or EntityManager.remove(record).
Now my question:
If one of my Business Objects get an EntityManager from the factory and open a transaction, I have an opened session in my current thread.
How is it possible for my DAOs to get this session to make any operations? Do I have to call Session.remove() or EntityManager.remove().
Regards
Christoph
|