-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
Andrew Goode opened SPR-6202 and commented
Add a new StatelessHibernateCallback interface with generic execution logic added to HibernateTemplate.
I have implemented similar functionality in my current project and have found that it's very useful for performing batch operations via Hibernate, especially when executing in threads outside the context of a Spring AOP-managed transaction. According to #7184 and related forum posts, direct support for StatelessSessions seems to be a popular request. This enhancement could be the first step to providing that support with Spring out-of-the-box.
The provided patch introduces the implementation used on my project in a form useful to others, including simple unit test. Admittedly, this proposed implementation may not be robust enough to satisfy all use cases, but it should serve as at least a good starting point. Will need to consider the implications of exposing thread-bound JDBC Connections and relying on implementation of SessionFactoryUtils#getDataSource(SessionFactory). Please see patch for details.
Affects: 3.0 RC1
Attachments:
- SPR-6202-RFE-patch.diff (8.72 kB)
Issue Links:
- Add a HibernateDaoSupport / HibernateTemplate exclusively for handling Hibernate Stateless Sessions [SPR-2899] #7587 Add a HibernateDaoSupport / HibernateTemplate exclusively for handling Hibernate Stateless Sessions
4 votes, 6 watchers