Well, it might be doable by slightly changing the CurrentSessionContext
intf slightly.  Instead of currentSession(), have
currentSession(SessionFactoryImplementor)

Additionally for ThreadLocalSessionContext, change the bind() and
unbind() methods appropriately.  Its internal ThreadLocal could then
keep a map of SessionFactory -> Session.


-----Original Message-----
From: Max Andersen 
Sent: Monday, October 03, 2005 9:21 AM
To: Steve Ebersole; Hibernate development
Subject: Re: [Hibernate] ThreadLocalSessionContext javadoc inconsistency

On Mon, 03 Oct 2005 16:15:01 +0200, Steve Ebersole  
<[EMAIL PROTECTED]> wrote:

> Here's another concern with the current impl for
> ThreadLocalSessionContext:  the static accessors.  Basically the way
> this is setup right now, users will nt be able to use this
> simultaneously for multiple session-factories...

oh - thats not nice. This becomes a global thing...would it make sense
to have getCurrentSession(string name); ...hmm i guess not...it is
equally
"hard" to keep track of the current name as well as the current  
sessionfactory.

bummer...i had hoped to use this in the eclipse plugin, but cant because
I  
actually
here by its nature can/will have multiple session-factories with
different  
strategies.

oh well - its still a good thing for 98% of the worlds applications ;)

/max

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Max
> Rydahl Andersen
> Sent: Saturday, October 01, 2005 10:32 AM
> To: Hibernate development
> Subject: [Hibernate] ThreadLocalSessionContext javadoc inconsistency
>
> hi,
>
> javadoc for ThreadLocalSessionContext state:
>
> "it unsafe for this impl to actually generate Session instances; thus
it
>
> does not"
>
> but at currentSession it does the following:
>
>               if (current == null) {
>                       log.debug("Current thread doesn't have a
> session, opening new");
>                       bind(factory.openSession( null,
>
> Which one should it be ?
>
> btw. any reason why we can't return Session instead of
classical.Session
> ?
>



-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]
http://www.jboss.com/events/jbossworld
JBoss World Barcelona 10-12 October


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to