Not illegal, just worthless.<br><br><br><div class="gmail_quote">On Wed, Apr 18, 2012 at 5:34 PM, Jason Porter <span dir="ltr"><<a href="mailto:lightguard.jp@gmail.com">lightguard.jp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
No, the problem is, as it exists today, this is not legal. You'll actually get a transaction scoped EM, which causes all sorts of confusion because there's also no transactions going on so your EM is actually closed the first time it's used. No warning, no exception just head smashing.<br>
<br>
Sent from my iPhone<br>
<div class="HOEnZb"><div class="h5"><br>
On Apr 18, 2012, at 9:30, "Lincoln Baxter, III" <<a href="mailto:lbaxter@redhat.com">lbaxter@redhat.com</a>> wrote:<br>
<br>
> I'm guessing the problem lies in the fact that the bean doing the<br>
> producing is not itself scoped?<br>
><br>
> On Wed 18 Apr 2012 11:25:06 AM EDT, Adam Bien wrote:<br>
>> The code above should work for Java EE 7 and CDI 1.1.<br>
>> The @RequestScoped @Produces below is not that reasonable, but @SessionScoped should work in CDI 1.1.<br>
>><br>
>> On 18.04.2012, at 00:37, Jason Porter wrote:<br>
>><br>
>>> I don't know where this should fail, but it needs to fail somewhere, and if CDI isn't it, I trust there are people on this list the other EGs will listen to because too many of them ignore the users list, because you know, they're the "experts".<br>
>>><br>
>>> public class EmProducer() {<br>
>>> � � @PersistenceContext(type = PersistenceContextType.EXTENDED)<br>
>>> � � EntityManager em;<br>
>>><br>
>>> � � @Produces @RequestScoped<br>
>>> � � public EntityManager getEntityManager() {<br>
>>> � � � � return em;<br>
>>> � � }<br>
>>> }<br>
>>><br>
>>> That should be a deployment exception stating it isn't valid (the @PersistenceContext injection).<br>
>>><br>
>>> --<br>
>>> Jason Porter<br>
>>> <a href="http://lightguard-jp.blogspot.com" target="_blank">http://lightguard-jp.blogspot.com</a><br>
>>> <a href="http://twitter.com/lightguardjp" target="_blank">http://twitter.com/lightguardjp</a><br>
>>><br>
>>> Software Engineer<br>
>>> Open Source Advocate<br>
>>> Author of Seam Catch - Next Generation Java Exception Handling<br>
>>><br>
>>> PGP key id: 926CCFF5<br>
>>> PGP key available at: <a href="http://keyserver.net" target="_blank">keyserver.net</a>, <a href="http://pgp.mit.edu" target="_blank">pgp.mit.edu</a><br>
>>> _______________________________________________<br>
>>> cdi-dev mailing list<br>
>>> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>>> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> cdi-dev mailing list<br>
>> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
><br>
> --<br>
> ---<br>
> Lincoln Baxter, III<br>
> <a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>
> "Simpler is better."<br>
><br>
> _______________________________________________<br>
> cdi-dev mailing list<br>
> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.suntriprecords.com">http://www.suntriprecords.com</a><br><br>