Ha, very observant - I am relying on it to commit or rollback or do  
nothing.

  I note your recommendation, but I'd rather not have transaction  
support code littered around.
For my application, I want a transaction lazily created  and closed  
after each request, if it was created.
If what I am doing is bad design or coding, Im willing to change it.

Oliver

On 20/12/2008, at 1:12 AM, Derek Chen-Becker wrote:

> What kind of error are you getting when the EM closes? As long as  
> you're not relying on the EM.close to commit your transaction  
> (something I'd recommend against anyway) then there really shouldn't  
> be any errors at this point.
>
> Derek
>
> On Thu, Dec 18, 2008 at 10:00 PM, Oliver <ola...@gmail.com> wrote:
>
> I started on that path, and thought I could redirect with something  
> like
>   Full(<span> "some html that redirects to the error page"...
> </span>).asInstanceOf[T]
> It feels like a big hack, even if I could get it working and I was a
> little worried about creating
> a redirection loop.
> I've created a static html error page and call it from web.xml for now
> - it'll have to do for now.
>
> On Fri, Dec 19, 2008 at 11:09 AM, David Pollak
> <feeder.of.the.be...@gmail.com> wrote:
> > I'd put a try/finally around the EM.closeEM call so that it does  
> not impact
> > the stuff that's being rendered to the browser.  Don't let the  
> exception in
> > the finally block propogate.
> >
> > On Thu, Dec 18, 2008 at 1:58 PM, Oliver <ola...@gmail.com> wrote:
> >>
> >> I was redirecting to an error page using
> >> LiftRules.logAndReturnExceptionToBrowser, but when I use a  
> LoanWrapper
> >> to close a EntityManager and an error occurs when closing the  
> entity
> >> manager, LiftRules.logAndReturnExceptionToBrowser doesn't appear to
> >> redirect to my error page. Can anyone think of a work around?
> >>
> >>
> >>        // Output a simple error to the user. Link the error message
> >> to the screen via the current datetime
> >>        LiftRules.logAndReturnExceptionToBrowser = {
> >>                RedirectResponse("/error);
> >>        }
> >>
> >>        // Set up a LoanWrapper to automatically close a  
> EntityManager
> >> if its open
> >>        S.addAround(List(
> >>                new LoanWrapper {
> >>                    def apply[T] (f : => T): T = {
> >>                        try {
> >>                            f
> >>                        } finally {
> >>                            EM.closeEM // close if open
> >>                        }
> >>                    }
> >>                }))
> >>
> >>    }
> >>
> >>
> >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Collaborative Task Management http://much4.us
> > Follow me: http://twitter.com/dpp
> > Git some: http://github.com/dpp
> >
> > >
> >
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to