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.
Sent from my iPhone
On Apr 18, 2012, at 9:30, "Lincoln Baxter, III" <lbaxter(a)redhat.com>
wrote:
I'm guessing the problem lies in the fact that the bean doing the
producing is not itself scoped?
On Wed 18 Apr 2012 11:25:06 AM EDT, Adam Bien wrote:
> The code above should work for Java EE 7 and CDI 1.1.
> The @RequestScoped @Produces below is not that reasonable, but @SessionScoped should
work in CDI 1.1.
>
> On 18.04.2012, at 00:37, Jason Porter wrote:
>
>> 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".
>>
>> public class EmProducer() {
>> @PersistenceContext(type = PersistenceContextType.EXTENDED)
>> EntityManager em;
>>
>> @Produces @RequestScoped
>> public EntityManager getEntityManager() {
>> return em;
>> }
>> }
>>
>> That should be a deployment exception stating it isn't valid (the
@PersistenceContext injection).
>>
>> --
>> Jason Porter
>>
http://lightguard-jp.blogspot.com
>>
http://twitter.com/lightguardjp
>>
>> Software Engineer
>> Open Source Advocate
>> Author of Seam Catch - Next Generation Java Exception Handling
>>
>> PGP key id: 926CCFF5
>> PGP key available at:
keyserver.net,
pgp.mit.edu
>> _______________________________________________
>> cdi-dev mailing list
>> cdi-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/cdi-dev
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/cdi-dev
--
---
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev