[cdi-dev] passivation capable parameters for producerMethods

Mark Struberg struberg at yahoo.de
Thu Jun 30 03:34:39 EDT 2011


Yes, the example with the EntityManager might be confusing. Just s/EntityManager/SomeOtherClass/ :)
(Btw, only EntityManagers provided by producer fields are 'injectable resources' as per the spec and thus made auto-serializable. Which is btw imo technically impossible if the EM contains locking states. But that's another story...

I wonder if Weld does implement this at all. We recently got an issue reported for OWB that some parts of Seam are not working.
It looks like OWB performs those tests and fails with a deployment exception whereas Weld doesn't detect it.
Are there TCK tests for this behaviour?

I'd favour to drop that language and functionality if noone objects.

Btw, there are also a few other occurrences :
6.6.4
> If a managed bean which declares a passivating scope:
> * has a non-transient injected field, <- that part is fine
> bean constructor parameter or initializer method parameter
> that does not resolve to a passivation capable dependency, or

But I don't get the contructor parameter and @Inject method parameter criteria.

txs and LieGrue,
strub


--- On Thu, 6/30/11, Pete Muir <pmuir at redhat.com> wrote:

> From: Pete Muir <pmuir at redhat.com>
> Subject: Re: [cdi-dev] passivation capable parameters for producerMethods
> To: "Mark Struberg" <struberg at yahoo.de>
> Cc: cdi-dev at lists.jboss.org
> Date: Thursday, June 30, 2011, 7:07 AM
> 
> On 29 Jun 2011, at 13:57, Mark Struberg wrote:
> 
> > Hi!
> > 
> > Section 6.6.4 declares that:
> > 
> >> If a producer method declares a passivating scope
> and:
> >> ..
> >> * has a parameter that does not resolve to a
> passivation capable 
> >> dependency, 
> >> then the container automatically detects the
> problem and 
> >> treats it as a deployment problem.
> > 
> > What is the reason for this restriction?
> 
> Not 100% sure. Any one else know?
> 
> > Something like
> > 
> > @Produces @SessionScoped @AutoAuthenticated
> > public User getCurrentUser(EntityManager em) {
> >   return ...
> > 
> > (EntityManager gets produced as @RequestScoped) would
> not be allowed because EntityManager is not Serializable.
> 
> Actually as long as you use a resource producer field then
> the CDI container must make it passivation capable ;-) But
> that just makes it a bad example, it doesn't solve the
> problem.



More information about the cdi-dev mailing list