Hello Imants,

The current implementation commits the transaction on thread cleanup -
see the HibernateSessionManagerImpl.  I suspect your analysis on this
is spot on, and the redirect beat the commit.

One quick fix might be to serialize requests per session by
synchronizing on it.  I don't know if there's a T5 way to do this, but
a simple filter is easy enough.

I've been meaning to post a feature request to switch from a thread
cleanup mechanism to using a contribution to the RequestHandler
pipeline.  I think this would solve several problems including the one
you're running into.

In a (somewhat) related thread[1], Thiago mentioned his own hibernate
integration project that you might look into.  I haven't had time to
look into it yet, nor to work on a patch to go with the feature
request :(.

Cheers,
lasitha.

[1] Sep 18th - T5: HibernateSessionManagerImpl should close session on
thread cleanup?
http://mail-archives.apache.org/mod_mbox/tapestry-users/200709.mbox/[EMAIL 
PROTECTED]


On 9/26/07, Imants Firsts <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I am trying to edit a hibernate entity in a tapestry
> form, and when the form is submitted the entitiy is
> saved to DB, and user is redirected to a ViewEntity page.
>
> After the submit I get an exception that entity does
> not exist (entity is actually created in db), if I hit
> the refresh button in the browser, it finds the entity
> and the page renders fine. I suspect that Tapestry sent
> redirect back to client before the transaction was
> commited to DB. The request for redirected page came in
> another thread before the previous request cleanup was
> completed and transaction successfully commited.
>
> How to solve this? What happens if the commit fails?
>
> Thanks,
> Imants
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to