Maybe this link will help: https://www.hibernate.org/43.html

> in the class JpaUtil. I don't like this approach because it depends on the
implicit assumption that each request is handled in a thread (this depends
on Wicket implementation details, therefor I dislike it)

This assumption is not true. It is perfectly fine to attach the
EntityManager to ThreadLocal since, per the spec, each request is guaranteed
to get assigned to a different thread. This is not a wicket implementation
detail, it is higher than that - threads are assigned by the container.

-Luther



On Tue, Jun 9, 2009 at 6:48 AM, Frank Tegtmeyer <[email protected]> wrote:

>
> > Well when it comes to EntityManagers be sure to close, commit and
> > clear your threadlocal instance after your service request cycle.
>
> Exactly that didn't work for me. I checked for open transactions,
> closed them, closed the EntityManager and even released it by setting
> the ThreadLocal variable to null.
> Although I created a new EntityManager  in onBeginRequest() I
> constantly got errors during form processing because of not existing
> EntityManager. I solved this by leaving EntityManager there after the
> request and checking for its existence at the begin of the request.
>
> Any ideas about this?
>
> Regards, Frank
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to