1 16 17 package org.springframework.orm.jpa; 18 19 import javax.persistence.EntityManagerFactory; 20 import javax.persistence.Persistence; 21 import javax.persistence.PersistenceException; 22 import javax.persistence.spi.PersistenceProvider; 23 24 68 public class LocalEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean { 69 70 74 protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException { 75 PersistenceProvider provider = getPersistenceProvider(); 76 if (provider != null) { 77 EntityManagerFactory emf = provider.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap()); 79 if (emf == null) { 80 throw new IllegalStateException ( 81 "PersistenceProvider [" + provider + "] did not return an EntityManagerFactory for name '" + 82 getPersistenceUnitName() + "'"); 83 } 84 return emf; 85 } 86 else { 87 return Persistence.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap()); 89 } 90 } 91 92 } 93 | Popular Tags |