I'm really fishing for a hivemind guru to tell me how to inject some
code in the tail end of the WebRequestServicer.service() method. That
would allow me to implement a general solution of flushing before the
response is committed and forcing the exception to occur at a point
where I can still notify the user. I want things to be automatic rather
than having to explicitly call Session.flush() in every listener
method. (If I was going to do that, I'd use an aspect.)
I know this doesn't quite solve your problem because you want to use
another session to render your error response. I'd consider a dedicated
session in pageBeginRender of my error page (with some extra error
handling) to set up the state for your error page.
-Steve
Michael Sims wrote:
Steve Shucker wrote:
Keep in mind the difference between a flush and a commit in hibernate.
A flush executes all the queued sql against the database without
committing the transaction. Hibernate does this whenever it has
changes that needed to be sent to the database before a query is run.
Otherwise, it defers the flush until just before the commit. Unless
you're using deferred constraints in oracle, constraint violations and
other db-related exceptions will be raised during the flush, not the
commit.
What I'd really like to do is configure something in hivemind that
would run just before tapestry commits the response. Then I could
call session.flush() there to force the exception before the response
is committed. I just don't know how I can accomplish this.
Ah, ok. Sorry about that, I guess I need to learn to be a bit more precise in
my
interpretation of the terms. Still, a "session manager" service would allow
you to
expose a method to flush() in a listener, yes? Or you want to make this more
transparent/automatic so you can just redirect to a static error page on any
exception without having to explicitly flush()?
That still doesn't help for my particular use case though... I need to catch the
error and still render a response that might need to access lazily-initialized
properties of Hibernate persisted objects...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]