/** * Create database schemas and/or tables and/or create DDL * scripts as determined by the supplied properties. * <p> * Called by the Persistence class when schema generation is to occur as a * separate phase from creation of the entity manager factory. * <p> * @param info the name of the persistence unit * @param properties properties for schema generation; these may also * contain provider-specific properties. The value of these * properties override any values that may have been configured * elsewhere. * @throws PersistenceException if insufficient or inconsistent * configuration information is provided of if schema generation * otherwise fails * * @since Java Persistence 2.1 */ @Override public void generateSchema(PersistenceUnitInfo info, Map properties) { if (checkForProviderProperty(properties)) { // Bug 458462 - Generate the DDL and then close. This method is // called when running within a container. createContainerEntityManagerFactoryImpl(info, properties, false).close(); } }
if (checkForProviderProperty(nonNullProperties)) { JPAInitializer initializer = getInitializer(puName, nonNullProperties); SEPersistenceUnitInfo puInfo = initializer.findPersistenceUnitInfo(puName, nonNullProperties); if (puInfo != null && checkForProviderProperty(properties)) {
/** * Called by Persistence class when an EntityManagerFactory * is to be created. * * @param emName The name of the persistence unit * @param properties A Map of properties for use by the * persistence provider. These properties may be used to * override the values of the corresponding elements in * the persistence.xml file or specify values for * properties not specified in the persistence.xml. * @return EntityManagerFactory for the persistence unit, * or null if the provider is not the right provider */ @Override public EntityManagerFactory createEntityManagerFactory(String emName, Map properties){ Map nonNullProperties = (properties == null) ? new HashMap() : properties; if (checkForProviderProperty(nonNullProperties)){ String name = (emName == null) ? "" : emName; JPAInitializer initializer = getInitializer(name, nonNullProperties); return createEntityManagerFactoryImpl(initializer.findPersistenceUnitInfo(name, nonNullProperties), nonNullProperties, true); } // Not EclipseLink so return null; return null; }