|
From: March, A. <am...@so...> - 2004-08-20 22:11:05
|
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...] On
Behalf
> Of Colin Sampaleanu
> Sent: Friday, August 20, 2004 2:53 PM
> To: spr...@li...
> Subject: Re: [Springframework-developer] HibernateInterceptor
>=20
> If you use the new mode of the OpenSessionInViewFilter where there are
> multiple sessions, but close is deferred, then in fact there is no
> existing session yet.
Don't know how new session per request is but that is what we use. I
guess I did not realize the session is not started until the tx is. I
am sure I will be reading more of that code soon.
>=20
> If you use the old mode, with just one session, then it's probably not
> the end of the world. The tx sync ensures a flush, and also a callback
> into Hibernate's SessionImplementor.afterTransactionCompletion()
> callback method. With the default flushmode setting, adding back in
the
> HibernateInterceptor to force a flush would not do it, since it would
> find the session already on the thread and would not flush on coming
> back, on that basis. You could force a flush with a FLUSH_EAGER
setting,
> but then if you had multiple wrapped invocaitons, you'd flush on
coming
> back from every one, not just the outer.
>=20
> I may be missing something; Juergen feel free to comment if the above
is
> not accurate.
>=20
> Regards,
> Colin
>=20
>=20
> March, Andres wrote:
>=20
> >How does this apply to OpenSessionInViewFilter though? The session
is
> >always opened before a transaction begins.
> >
> >
> >
> >>-----Original Message-----
> >>From: spr...@li...
> >>[mailto:spr...@li...] On
> >>
> >>
> >Behalf
> >
> >
> >>Of Colin Sampaleanu
> >>Sent: Friday, August 20, 2004 11:11 AM
> >>To: spr...@li...
> >>Subject: [Springframework-developer] HibernateInterceptor
> >>
> >>Juergen,
> >>
> >>If the HibernateInterceptor is currently applied before the
> >>TransactionInterceptor instead of after it, the invoke method still
> >>ensures the SessionHolder is bound to the thread, but no
> >>
> >>
> >synchronization
> >
> >
> >>can be registered of course. In this case, all you get is a logged
> >> logger.debug("Using new session for Hibernate
> >>
> >>
> >interceptor");
> >
> >
> >>Do you think it's perhaps worth being a bit more explicit and
> >>
> >>
> >mentioning
> >
> >
> >>that no transaction currently exists? Most of the time, unless
> >>
> >>
> >somebody
> >
> >
> >>really wants to use HibernateInterceptor to create sessions outside
of
> >>
> >>
> >a
> >
> >
> >>transaction, this will be a config error, and people would be better
> >>
> >>
> >of
> >
> >
> >>changing the ordering so that the session is created after the
> >>transaction, and can be synchronized...
> >>
> >>Colin
> >>
> >>
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank
Media
> >>100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> >>Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> >>http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> >>_______________________________________________
> >>Springframework-developer mailing list
> >>Spr...@li...
>
>>https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >>
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|