[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2960) Add Interceptor to the openSession method the CurrentSessionContexts use

Shawn Clowater (JIRA) noreply at atlassian.com
Tue Nov 20 20:27:56 EST 2007


Add Interceptor to the openSession method the CurrentSessionContexts use
------------------------------------------------------------------------

                 Key: HHH-2960
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2960
             Project: Hibernate3
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.2.5
            Reporter: Shawn Clowater
            Priority: Minor


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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list