[seam-dev] @Unwrap implementation in weld-extensions
Stuart Douglas
stuart at baileyroberts.com.au
Mon Apr 19 23:57:38 EDT 2010
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
More information about the seam-dev
mailing list