[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2960?page=c...
]
Steve Ebersole commented on HHH-2960:
-------------------------------------
I had proposed a pluggable {{SessionInterceptorFactory}} which maybe would suit your need
too. Though I agree that these builders probably make it less relevant. The idea was
that you could register a {{SessionInterceptorFactory}} with the {{SessionFactory}} and it
would ask it for an {{Interceptor}} whenever it was going to open a {{Session}}.
As for the connection usage, dont forget about {{doWork}} and {{doReturningWork}} on
{{Session}}
Add Interceptor to the openSession method the CurrentSessionContexts
use
------------------------------------------------------------------------
Key: HHH-2960
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2960
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Reporter: Shawn Clowater
Priority: Minor
Attachments: HHH-2960-3.3.SP1.patch, HHH-2960.patch
Ran into a minor snag earlier where I was rigging up the stateful audit interceptor and
didn't have a clean hook to jack the interceptor for my current session.
The sample code illustrates the use of the interceptor by using the
sessionFactory.openSession(Interceptor) method and then goes on to say with the wave of a
hand that if you're using the getCurrentSession functionality that you'll have to
override whatever CurrentSessionContext you're using. That's a little bit more
cumbersome that I was hoping for but to make matters worse the method that the
ThreadLocalCurrentSessionContext is using to obtain the session is:
public org.hibernate.classic.Session openSession(
final Connection connection,
final boolean flushBeforeCompletionEnabled,
final boolean autoCloseSessionEnabled,
final ConnectionReleaseMode connectionReleaseMode) throws HibernateException;
There are no other constructors that I can see that combine all of these parameters with
the addition of an Interceptor parameter. It would be a nice to have if there were an
overloaded method that accepted the addition of an Interceptor.
I worked around it for now but I am ashamed at the way I'm storing state for my
interceptor.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira