Re: T5: getting current hibernate session (per-thread) from singleton-service

2009-02-04 Thread Kalle Korhonen
Sure, easy to do that in my application code. However, this is a service (that injects a session into it) in a Trails library that builds on tapestry-hibernate. I can change the library, but I was just wondering if it'd be worth and possible to fix in tapestry-hibernate itself. Kalle On Wed, Feb

Re: T5: getting current hibernate session (per-thread) from singleton-service

2009-02-04 Thread Howard Lewis Ship
HibernateSessionManager.getSession() On Wed, Feb 4, 2009 at 9:16 PM, Kalle Korhonen wrote: > Noo.. it doesn't have anything to with request context or not. Just that > doing DetachedCriteria.getExecutableCriteria(session) just won't work with > the shadow Session proxy because Hibernate tries to

Re: T5: getting current hibernate session (per-thread) from singleton-service

2009-02-04 Thread Kalle Korhonen
Noo.. it doesn't have anything to with request context or not. Just that doing DetachedCriteria.getExecutableCriteria(session) just won't work with the shadow Session proxy because Hibernate tries to cast it to SessionImplementor. Wonder if it could be fixed in tapestry-hibernate, telling the proxy

Re: T5: getting current hibernate session (per-thread) from singleton-service

2009-02-04 Thread Kalle Korhonen
I just hit the same problem "cannot be cast to ...SessionImplementor" while trying to use Hibernate session in a service that auto-populates some entries to the database at start-up (so obviously not in request context). Did anybody find a solution for this? Kalle On Wed, Jul 9, 2008 at 10:08 AM

Re: T5: getting current hibernate session (per-thread) from singleton-service

2008-07-09 Thread Britske
Wow I love that. Somehow I mistakenly thought it didn't work that way, thanks. As a related question : is there a way to get the 'real' session instead of the proxy on a call to getSession() The reason I'm asking is that in a lot of cases I want to use (Hibernate's) DetachedCriteria's, so I c

Re: T5: getting current hibernate session (per-thread) from singleton-service

2008-07-09 Thread Howard Lewis Ship
If you are using tapestry-hibernate, the injectable Session service is a perthread proxy. It can be shared across threads, but each method invocation on the proxy is redirected to a real per-thread Hibernate session. On Wed, Jul 9, 2008 at 9:27 AM, Britske <[EMAIL PROTECTED]> wrote: > > I found s

Re: T5: getting current hibernate session (per-thread) from singleton-service

2008-07-09 Thread Josh Canfield
> > How can I get the current (per-thread) hibernate-session (as configured > through tapestry-hibernate) from a singleton custom tapestry service? > I haven't tried creating a getInstance type method for my service classes, but here is my understanding. The default scope for a service is singleto