[seam-dev] @Unwrap implementation in weld-extensions

Pete Muir pmuir at redhat.com
Tue Apr 20 06:15:51 EDT 2010


Yes, I agree. I had raised this issue during spec development - that there was no truly stateless scope in CDI, where the bean instance was created every time.

I would like to hear from the 299 EG about this as well.

On 20 Apr 2010, at 04:57, Stuart Douglas wrote:

> I think that there is a real use case for something similar to the @Unwrap feature of seam 2.
> 
> I think that it would be possible to implement something like this:
> 
> @ConversationScoped
> public class ManagedPersistenceContext
> {
> 
>  EntityManager entityManager;
> 
>  @Unwrap
>  @SomeQualifier
>  public EntityManager produce(InjectionPoint injectionPoint)
>  {
>    entityManager.joinTransaction();
>    return entityManager;
>  }
> }
> 
> public class MyClass
> {
>  @Inject @SomeQualifier EntityManager entityManager;
> }
> 
> the way I envisage this working is that a proxy gets injected into MyClass, and this proxy calls ManagedPersistenceContext.produce to resolve the correct EntityManager to pass the call to every time a method is invoked on the proxy.
> 
> I am pretty sure I can implement this in weld-extensions using JDK proxies, does this sound like a good idea?
> 
> Stuart
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev




More information about the seam-dev mailing list