Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

Re: [NHibernate-development] EmptyInterceptor SetSession /
 Session  Factory Breaking Changes

Andrew Mayorov

2008-06-20

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi!

 

Guys, I’m not sure that I got the very nature of this question, because I read the list by diagonal, but I want to drop my 5 cents also. For me it looks like a design flaw in IInterceptor interface itself. If every its method would accept session reference as a parameter, then all problems with SetSession would be gone. In most applications it’s enough to have factory-level interceptor, because interceptor methods are stateless by its nature. At the same time access to the session is often necessary… No argue that this is breaking change though.

 

Best,

Andrew

 

From: nhibernate-development-bounces@lists.sourceforge.net [mailto:nhibernate-development-bounces@lists.sourceforge.net] On Behalf Of Ayende Rahien
Sent: Thursday, June 19, 2008 7:13 PM
To: the NHibernate development list
Subject: Re: [NHibernate-development] EmptyInterceptor SetSession / Session Factory Breaking Changes

 

On Thu, Jun 19, 2008 at 3:14 PM, Fabio Maulo <fabiomaulo@gmail.com> wrote:

Do you think it is useful for any kind of session or only when the user specify an interceptor for a session ?

session-scoped (and only session scoped)


Yes, because factory scoped session can't use it, we don't want to put the burden on doing thread management on the user.
 

 

The comment about "session-scoped interceptor" is not a minor thing. Like you know the user have the ability to set the interceptor at the sessionFactory level (mean in configuration) and this interceptor will be used for all sessions. In this scenario we can't assign the session to the interceptor because the interceptor must be tread-safe and multi-session.
We can add the feature but it is very important to write something in the documentation to let know to our user that it work only for session-scoped-interceptor that mean:
sessionFactory.OpenSession(new MyInterceptor());

The user can't use a static instance or a singleton.


Agreed.
Hm, I am not using that, but we do have the idea of the current session, right?
We can use that instead of SetSession, no?
 


If we agree I need help to write a documentation chunk to explain how use this feature.
--
Fabio Maulo
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nhibernate-development

 

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.