I had to add rollback logic to the HibernateSessionManager, but I didn't add
a close. I haven't seen the exception you are reporting, but I don't know
hibernate well enough to say definitively that this is ok. The session is
marked to close with the transaction commit/rollback, but I didn't see it
get closed when stepping through in the debugger.

On 9/19/07, lasitha <[EMAIL PROTECTED]> wrote:
>
> Hate to bump my own thread, but i'd really like some feedback before i
> post a bug on jira.
> If i'm not mistaken, this will be a problem for anyone using
> tapestry-hibernate.
>
> Summary: I think HibernateSessionManagerImpl needs to be closing
> sessions on thread cleanup.
>
> On 9/18/07, lasitha <[EMAIL PROTECTED]> wrote:
> > Hello all.
> >
> > Back in June (23rd), Bill Holloway solved an 'illegal attempt to
> > associate a collection with two open sessions' hibernate exception by
> > using merge() after reattaching a detached object:
> > Re: T5 Creating new hibernate persistent entity via beaneditform
> >
> http://mail-archives.apache.org/mod_mbox/tapestry-users/200706.mbox/[EMAIL 
> PROTECTED]
> >
> > I wasn't quite convinced with this because that exception (though
> > often maligned!) is usually quite accurate.  Moreover, if there were
> > two sessions in play, using merge() would effectively _avoid_ the
> > issue by hydrating a new _copy_ of the (supposedly) detached object.
> >
> > So i've been digging around (since, rather inevitably, i'm also seeing
> > this exception), and i don't see where the HibernateSessionManagerImpl
> > is actually _closing_ the thread local session...
> >
> > What am i missing?  It seems unlikely we've been geting away with not
> > closing sessions.  Where might this be happening?
> >
> > To test the theory i patched HibernateSessionManagerImpl to close the
> > session immediately after committing:
> > public void threadDidCleanup() {
> >     _transaction.commit();
> >     _session.close();
> > }
> >
> > This gets rid of my 'illegal attempt...' exceptions!
> >
> > Any insight appreciated.
> > Thanks,
> > lasitha.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to