/** * Set the location of the {@code persistence.xml} file * we want to use. This is a Spring resource location. * <p>Default is "classpath:META-INF/persistence.xml". * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b> * @param persistenceXmlLocation a Spring resource String * identifying the location of the {@code persistence.xml} file * that this LocalContainerEntityManagerFactoryBean should parse * @see #setPersistenceUnitManager */ public void setPersistenceXmlLocation(String persistenceXmlLocation) { this.internalPersistenceUnitManager.setPersistenceXmlLocation(persistenceXmlLocation); }
/** * Set the location of the {@code persistence.xml} file * we want to use. This is a Spring resource location. * <p>Default is "classpath:META-INF/persistence.xml". * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b> * @param persistenceXmlLocation a Spring resource String * identifying the location of the {@code persistence.xml} file * that this LocalContainerEntityManagerFactoryBean should parse * @see #setPersistenceUnitManager */ public void setPersistenceXmlLocation(String persistenceXmlLocation) { this.internalPersistenceUnitManager.setPersistenceXmlLocation(persistenceXmlLocation); }
/** * Set the location of the {@code persistence.xml} file * we want to use. This is a Spring resource location. * <p>Default is "classpath:META-INF/persistence.xml". * <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b> * @param persistenceXmlLocation a Spring resource String * identifying the location of the {@code persistence.xml} file * that this LocalContainerEntityManagerFactoryBean should parse * @see #setPersistenceUnitManager */ public void setPersistenceXmlLocation(String persistenceXmlLocation) { this.internalPersistenceUnitManager.setPersistenceXmlLocation(persistenceXmlLocation); }
@Override protected EntityManagerFactory createEntityManagerFactory() { DefaultPersistenceUnitManager internalPersistenceUnitManager = new DefaultPersistenceUnitManager(); internalPersistenceUnitManager.setPersistenceXmlLocation(getHibernateConnection().getPath()); internalPersistenceUnitManager.setDefaultPersistenceUnitRootLocation(null); internalPersistenceUnitManager.preparePersistenceUnitInfos(); PersistenceUnitInfo persistenceUnitInfo = internalPersistenceUnitManager.obtainDefaultPersistenceUnitInfo(); EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(persistenceUnitInfo, Collections.emptyMap()); return builder.build(); }