But is the select for update done inside the entitymanager object or a query instance?  I don&#39;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">&lt;<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>&gt;</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 &quot;select for update&quot; or any manual locking, you will end up with an EntityManager which cannot be transfered to another node. Even if hibernate marks it&#39;s EntityManager Serializable, it just isn&#39;t if I didn&#39;t miss something!<br>

<br>
LieGrue,<br>
strub<br>
<br>
--- On Sun, 7/10/11, Stuart Douglas &lt;<a href="mailto:stuart.w.douglas@gmail.com">stuart.w.douglas@gmail.com</a>&gt; wrote:<br>
<br>
&gt; From: Stuart Douglas &lt;<a href="mailto:stuart.w.douglas@gmail.com">stuart.w.douglas@gmail.com</a>&gt;<br>
&gt; Subject: Re: [seam-dev] [seam-persistence] ManagedPersistenceContextExtension<br>
&gt; To: &quot;Mark Struberg&quot; &lt;<a href="mailto:struberg@yahoo.de">struberg@yahoo.de</a>&gt;<br>
&gt; Cc: <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
&gt; Date: Sunday, July 10, 2011, 11:07 PM<br>
<div><div></div><div class="h5">&gt;<br>
&gt; On 11/07/2011, at 4:07 AM, Mark Struberg wrote:<br>
&gt;<br>
&gt; &gt; Hi folks!<br>
&gt; &gt;<br>
&gt; &gt; While reviewing an OWB bug report, 2 questions came<br>
&gt; up:<br>
&gt; &gt;<br>
&gt; &gt; a.) EnvironmentUtils#isEEEnvironment() relies on the<br>
&gt; absence of &#39;javax.ejb.Stateless&#39; to decide if a<br>
&gt; PersitenceUnit gets injected or if you need to do it<br>
&gt; yourself. I think this is an unrelieable assumption. E.g.<br>
&gt; there are a few Extensions which emulate Stateless Session<br>
&gt; beans via a CDI Extension by morphing them into<br>
&gt; @ApplicationScoped.<br>
&gt;<br>
&gt; This is not ideal, but I don&#39;t think there is really any<br>
&gt; portable way to detect if the environment is an EE<br>
&gt; environment or not. I was originally planning to add a<br>
&gt; method for configuring this, but it appears I did not get<br>
&gt; around to it.<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; b.) in<br>
&gt; ManagedPersistenceContextExtension#registerManagedPersistenceContext<br>
&gt; you register the bean for the EntityManager as<br>
&gt; passivationCapable. This is never _never_ NEVER true. The<br>
&gt; EntityManager is not Serializable! There is imo no way to<br>
&gt; have an EntityManager in a bean scoped other than<br>
&gt; @RequestScoped or shorter (e.g. @TransactionalScoped). Any<br>
&gt; other trick is not working in a portable way. This is mainly<br>
&gt; caused by JPA still supporting pessimistic locking (_real_<br>
&gt; locks in the database) as first class citizens.<br>
&gt; &gt;<br>
&gt;<br>
&gt; Without this it is not possible to have a conversation<br>
&gt; scoped entity manager. The hibernate EntityManager is in<br>
&gt; fact Serializable. Locks should not be a problem as long as<br>
&gt; you do not attempt to serialise the EM in the middle of a<br>
&gt; transaction.<br>
&gt;<br>
&gt; Stuart<br>
&gt;<br>
&gt;<br>
&gt; &gt; But I&#39;d be happy if anyone could enlighten me and tell<br>
&gt; us how it works ;)<br>
&gt; &gt;<br>
&gt; &gt; LieGrue,<br>
&gt; &gt; strub<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; seam-dev mailing list<br>
&gt; &gt; <a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
&gt;<br>
&gt;<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>