|
From: Colin S. <col...@ex...> - 2003-07-28 01:27:24
|
I think it would be useful to enhance HibernateTemplate to work in a mode such that it doesn't create the session if it isn't already bound on the thread. That is, there would be a new constructor which mirrors the SessionFactoryUtils.getSession(factory, boolean) method signature. With the new convenience methods and the wrapping of Hibernate exceptions, I think HibernateTemplate is useful in some cases even when HibernateInterceptor is used to actually bind the session to the thread. However, in the latter case, I am somewhat worrried about using HibernateTemplate as it now exists since there is the danger of missing the interceptor in one place and accidentally auto creating the session. |