Author: pete.muir(a)jboss.org
Date: 2010-09-02 13:43:39 -0400 (Thu, 02 Sep 2010)
New Revision: 13708
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java
Log:
custom bean name for SMPCs
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java
===================================================================
---
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java 2010-09-02
14:04:59 UTC (rev 13707)
+++
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextExtension.java 2010-09-02
17:43:39 UTC (rev 13708)
@@ -32,6 +32,7 @@
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMember;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
@@ -124,7 +125,7 @@
{
modifiedType.removeFromField(f.getJavaMember(), scope);
}
- registerManagedPersistenceContext(qualifiers, scope, manager,
event.getAnnotatedType().getJavaClass().getClassLoader());
+ registerManagedPersistenceContext(qualifiers, scope, manager,
event.getAnnotatedType().getJavaClass().getClassLoader(), f);
}
// now look for producer methods that produce an EntityManagerFactory.
// This allows the user to manually configure an EntityManagerFactory
@@ -164,7 +165,7 @@
// we need to change the scope to application scoped
modifiedType.removeFromMethod(m.getJavaMember(), scope);
modifiedType.addToMethod(m.getJavaMember(),
ApplicationScopedLiteral.INSTANCE);
- registerManagedPersistenceContext(qualifiers, scope, manager,
event.getAnnotatedType().getJavaClass().getClassLoader());
+ registerManagedPersistenceContext(qualifiers, scope, manager,
event.getAnnotatedType().getJavaClass().getClassLoader(), m);
}
}
@@ -174,7 +175,7 @@
}
}
- private void registerManagedPersistenceContext(Set<Annotation> qualifiers,
Class<? extends Annotation> scope, BeanManager manager, ClassLoader loader)
+ private void registerManagedPersistenceContext(Set<Annotation> qualifiers,
Class<? extends Annotation> scope, BeanManager manager, ClassLoader loader,
AnnotatedMember<?> member)
{
// we need to add all additional interfaces from our
// SeamPersistenceProvider to the bean as at this stage we have no way of
@@ -197,6 +198,7 @@
builder.getTypes().addAll(additionalInterfaces);
builder.getTypes().add(Object.class);
builder.setBeanLifecycle(lifecycle);
+ builder.setToString("Seam Managed Persistence Context with qualifiers ["
+ qualifiers + "] with configured by [" + member + "]");
beans.add(builder.create());
}