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

Shawn Clowater (JIRA) noreply at atlassian.com
Fri Apr 1 12:11:08 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41934#action_41934 ] 

Shawn Clowater commented on HHH-2960:
-------------------------------------

This should be obsolete with the work done in HHH-2860

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

        


More information about the hibernate-issues mailing list