Register / Login
Win a copy of
97 Things Every Java Programmer Should Know
this week in the
Java in General
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
Object Relational Mapping
Implementing Hibernate Session per Request using EJB CMT
posted 11 years ago
I'm looking for a few pointers on implementing the hibernate session per request
for the following scenario,
The environment will consist of Spring 2.0, Hibernate 3.x, and
2.1 [with CMT]
The problem involves an EJB method which calls a number of methods involving several DAO's that insert/read from the database.
In this instance we'd be using CMT configured through the deployment descriptor with app values for propagation.
I'd like to use the same Hibernate session for all database access operations.
Having looked through the hibernate documentation, I've figured that I need to set the following properties
i.) hibernate.transaction.factory_class = org.hibernate.transaction.CMTTransactionFactory
iii.) hibernate.current_session_context_class =
[Do I need this?]
iv.)Finally, in my DAOs [all extending HibernateDaoSupport) would I have to replace all references of HibernateTemplate with app calls to sessionFactory.getCurrentSession(), e.g.
getHibernateTemplate().find(...) with this.getSessionFactory().getCurrentSession().find(...) etc.
Is this all I need to do or am I on the wrong track?
thanking you in advance,
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
Boost this thread!
Confusion between Entity and Session Bean
Webservice & EJB
Caching in Hibernate
Hibernate and EJB
Hibernate connection close issue.