But is the select for update done inside the entitymanager object or a query instance? I don't think EntityManager.find(Class,Id) does any type of hold on the object found.<br><br>John<br><br><div class="gmail_quote">
On Sun, Jul 10, 2011 at 7:15 PM, Mark Struberg <span dir="ltr"><<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Stu, whenever you do a "select for update" or any manual locking, you will end up with an EntityManager which cannot be transfered to another node. Even if hibernate marks it's EntityManager Serializable, it just isn't if I didn't miss something!<br>
<br>
LieGrue,<br>
strub<br>
<br>
--- On Sun, 7/10/11, Stuart Douglas <<a href="mailto:stuart.w.douglas@gmail.com">stuart.w.douglas@gmail.com</a>> wrote:<br>
<br>
> From: Stuart Douglas <<a href="mailto:stuart.w.douglas@gmail.com">stuart.w.douglas@gmail.com</a>><br>
> Subject: Re: [seam-dev] [seam-persistence] ManagedPersistenceContextExtension<br>
> To: "Mark Struberg" <<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>><br>
> Cc: <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
> Date: Sunday, July 10, 2011, 11:07 PM<br>
<div><div></div><div class="h5">><br>
> On 11/07/2011, at 4:07 AM, Mark Struberg wrote:<br>
><br>
> > Hi folks!<br>
> ><br>
> > While reviewing an OWB bug report, 2 questions came<br>
> up:<br>
> ><br>
> > a.) EnvironmentUtils#isEEEnvironment() relies on the<br>
> absence of 'javax.ejb.Stateless' to decide if a<br>
> PersitenceUnit gets injected or if you need to do it<br>
> yourself. I think this is an unrelieable assumption. E.g.<br>
> there are a few Extensions which emulate Stateless Session<br>
> beans via a CDI Extension by morphing them into<br>
> @ApplicationScoped.<br>
><br>
> This is not ideal, but I don't think there is really any<br>
> portable way to detect if the environment is an EE<br>
> environment or not. I was originally planning to add a<br>
> method for configuring this, but it appears I did not get<br>
> around to it.<br>
><br>
> ><br>
> > b.) in<br>
> ManagedPersistenceContextExtension#registerManagedPersistenceContext<br>
> you register the bean for the EntityManager as<br>
> passivationCapable. This is never _never_ NEVER true. The<br>
> EntityManager is not Serializable! There is imo no way to<br>
> have an EntityManager in a bean scoped other than<br>
> @RequestScoped or shorter (e.g. @TransactionalScoped). Any<br>
> other trick is not working in a portable way. This is mainly<br>
> caused by JPA still supporting pessimistic locking (_real_<br>
> locks in the database) as first class citizens.<br>
> ><br>
><br>
> Without this it is not possible to have a conversation<br>
> scoped entity manager. The hibernate EntityManager is in<br>
> fact Serializable. Locks should not be a problem as long as<br>
> you do not attempt to serialise the EM in the middle of a<br>
> transaction.<br>
><br>
> Stuart<br>
><br>
><br>
> > But I'd be happy if anyone could enlighten me and tell<br>
> us how it works ;)<br>
> ><br>
> > LieGrue,<br>
> > strub<br>
> > _______________________________________________<br>
> > seam-dev mailing list<br>
> > <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
> > <a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
><br>
><br>
_______________________________________________<br>
seam-dev mailing list<br>
<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
</div></div></blockquote></div><br>