use of org.apache.deltaspike.jpa.api.entitymanager.PersistenceUnitName in project deltaspike by apache.
the class EntityManagerFactoryProducer method createEntityManagerFactoryForUnit.
@Produces
@Dependent
// the value is nonbinding, thus 'any' is just a dummy parameter here
@PersistenceUnitName("any")
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);
return emf;
}
Aggregations