@Produces
@Dependent
@PersistenceUnitName("any") // the value is nonbinding, thus 'any' is just a dummy parameter here
public EntityManagerFactory createEntityManagerFactoryForUnit(InjectionPoint injectionPoint)
{
PersistenceUnitName unitNameAnnotation = injectionPoint.getAnnotated().getAnnotation(PersistenceUnitName.class);
if (unitNameAnnotation == null)
{
LOG.warning("@PersisteneUnitName annotation could not be found at EntityManagerFactory injection point!");
return null;
}
String unitName = unitNameAnnotation.value();
Properties properties = persistenceConfigurationProvider.getEntityManagerFactoryConfiguration(unitName);
EntityManagerFactory emf = Persistence.createEntityManagerFactory(unitName, properties);