if(entityManagerFactory != null) return;
try {
if(persistenceUnitName == null){
throw new PersistenceException("SimpleJPAUtil requires a call to setPersistenceUnitName before using.");
}
entityManagerFactory = new EntityManagerFactoryImpl(persistenceUnitName, getProps(), libsToScan, null);
// todo: use Persistence class: entityManagerFactory = Persistence.createEntityManagerFactory(persistenceUnitName != null ? persistenceUnitName : DEFAULT_PERSISTENCE_UNIT);
} catch (Throwable ex) {
// Log exception!
ex.printStackTrace();
logger.log(Level.SEVERE, "Initial SessionFactory creation failed.", ex);