@Override @SuppressWarnings("rawtypes") protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map properties, ClassLoader providedClassLoader) { EntityManagerFactoryBuilder builder; LOG.tracef("Attempting to obtain correct EntityManagerFactoryBuilder for persistenceUnitName : %s", persistenceUnitName); final Map integration = wrap(properties); PersistenceUnitDescriptor persistenceUnit = getPersistenceXmlDescriptor(persistenceUnitName, properties, providedClassLoader); if (persistenceUnit == null) { LOG.debug("Found no matching persistence units"); builder = null; } else { builder = Bootstrap.getEntityManagerFactoryBuilder(persistenceUnit, integration, providedClassLoader); } return builder; }
/** * {@inheritDoc} * <p/> * Improved with transaction and data source swapping properties */ @SuppressWarnings("rawtypes") @Override public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties) { EntityManagerFactory emf; LOG.tracef("Starting createContainerEntityManagerFactory : %s", info.getPersistenceUnitName()); PersistenceUnitDescriptor descriptor = getPersistenceUnitDescriptor(info); emf = Bootstrap.getEntityManagerFactoryBuilder(descriptor, properties).build(); return emf; }
/** * Generates schema from {@link PersistenceUnitInfo} instance */ @SuppressWarnings("rawtypes") @Override public void generateSchema(PersistenceUnitInfo info, Map map) { LOG.tracef("Starting generateSchema : PUI.name=%s", info.getPersistenceUnitName()); PersistenceUnitDescriptor descriptor = getPersistenceUnitDescriptor(info); final EntityManagerFactoryBuilder builder = Bootstrap.getEntityManagerFactoryBuilder(descriptor, map); builder.generateSchema(); }
private void build(List<Class> entities) { // Add new entities if not exists if (entities != null) { MutablePersistenceUnitInfo mutablePersistenceUnitInfo = (MutablePersistenceUnitInfo) info; for (Class entity : entities) { mutablePersistenceUnitInfo.addManagedClassName(entity.getName()); } } entityManagerFactory = Bootstrap.getEntityManagerFactoryBuilder(info, properties).build(); }
public TwoPhaseBootstrapImpl(final PersistenceUnitInfo info, final Map map) { entityManagerFactoryBuilder = Bootstrap.getEntityManagerFactoryBuilder(info, map); }