javax.persistence.spi.PersistenceProvider Java Examples

The following examples show how to use javax.persistence.spi.PersistenceProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Persistence.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create and return an EntityManagerFactory for the named persistence unit
 * using the given properties.
 * 
 * @param persistenceUnitName
 *            the name of the persistence unit
 * @param properties
 *            Additional properties to use when creating the factory. 
 *            These properties may include properties to control
 *            schema generation.  The values of these properties override 
 *            any values that may have been configured elsewhere.
 * @return the factory that creates EntityManagers configured according to
 *         the specified persistence unit.
 */
public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {

    EntityManagerFactory emf = null;
    PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver();

    List<PersistenceProvider> providers = resolver.getPersistenceProviders();

    for (PersistenceProvider provider : providers) {
        emf = provider.createEntityManagerFactory(persistenceUnitName, properties);
        if (emf != null) {
            break;
        }
    }
    if (emf == null) {
        throw new PersistenceException("No Persistence provider for EntityManager named " + persistenceUnitName);
    }
    return emf;
}
 
Example #2
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public EntityManagerFactory createContainerEntityManagerFactory(final PersistenceUnitInfo info,
		final Map map) {
	initJpaCounter();
	final PersistenceProvider persistenceProvider = findDelegate(map);
	// on surcharge PersistenceUnitInfo.getPersistenceProviderClassName()
	// pour retourner le PersistenceProvider délégué et pas nous même
	final PersistenceUnitInfo proxiedInfo = createPersistentUnitInfoProxy(info,
			persistenceProvider);
	final Map overridenMap = new HashMap();
	if (map != null) {
		overridenMap.putAll(map);
	}
	// #869 No Persistence provider for EntityManager, with Hibernate 5.4 & JPA
	// (when JpaOverridePersistenceXmlClassLoader is not enough)
	overridenMap.put(JPA_PERSISTENCE_PROVIDER, persistenceProvider.getClass().getName());
	final EntityManagerFactory entityManagerFactory = persistenceProvider
			.createContainerEntityManagerFactory(proxiedInfo, overridenMap);
	if (entityManagerFactory == null) {
		return null;
	}
	return JpaWrapper.createEntityManagerFactoryProxy(entityManagerFactory);
}
 
Example #3
Source File: PersistenceTestCase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    URL persistenceProviderUrl = FileUtil.getArchiveRoot(PersistenceProvider.class.getProtectionDomain().getCodeSource().getLocation());
    ProtectionDomain domain = Resource.class.getProtectionDomain();
    System.out.println("Protection domain: " + domain);
    CodeSource source = domain.getCodeSource();
    System.out.println("Code source: " + source);
    if (source != null) {
        URL location = source.getLocation();
        System.out.println("Location: " + location);
        URL resourceUrl = FileUtil.getArchiveRoot(location);
        addCompileRoots(Arrays.asList(persistenceProviderUrl, resourceUrl));
    } else {
        addCompileRoots(Arrays.asList(persistenceProviderUrl));
    }
}
 
Example #4
Source File: LocalEntityManagerFactoryBean.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Initialize the EntityManagerFactory for the given configuration.
 * @throws javax.persistence.PersistenceException in case of JPA initialization errors
 */
@Override
protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
	if (logger.isDebugEnabled()) {
		logger.debug("Building JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'");
	}
	PersistenceProvider provider = getPersistenceProvider();
	if (provider != null) {
		// Create EntityManagerFactory directly through PersistenceProvider.
		EntityManagerFactory emf = provider.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
		if (emf == null) {
			throw new IllegalStateException(
					"PersistenceProvider [" + provider + "] did not return an EntityManagerFactory for name '" +
					getPersistenceUnitName() + "'");
		}
		return emf;
	}
	else {
		// Let JPA perform its standard PersistenceProvider autodetection.
		return Persistence.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
	}
}
 
Example #5
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 6 votes vote down vote up
@Override
public List<PersistenceProvider> getPersistenceProviders() {
	// avant de retourner la liste des persistence providers
	// on met notre JpaPersistence en premier pour qu'il soit toujours choisi
	// et qu'il délègue au persistence provider final
	final List<PersistenceProvider> providers = delegate.getPersistenceProviders();
	final List<PersistenceProvider> result = new ArrayList<PersistenceProvider>();
	for (final PersistenceProvider provider : providers) {
		if (provider instanceof JpaPersistence) {
			result.add(0, provider);
		} else {
			result.add(provider);
		}
	}
	return result;
}
 
Example #6
Source File: LocalEntityManagerFactoryBean.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize the EntityManagerFactory for the given configuration.
 * @throws javax.persistence.PersistenceException in case of JPA initialization errors
 */
@Override
protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
	if (logger.isInfoEnabled()) {
		logger.info("Building JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'");
	}
	PersistenceProvider provider = getPersistenceProvider();
	if (provider != null) {
		// Create EntityManagerFactory directly through PersistenceProvider.
		EntityManagerFactory emf = provider.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
		if (emf == null) {
			throw new IllegalStateException(
					"PersistenceProvider [" + provider + "] did not return an EntityManagerFactory for name '" +
					getPersistenceUnitName() + "'");
		}
		return emf;
	}
	else {
		// Let JPA perform its standard PersistenceProvider autodetection.
		return Persistence.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
	}
}
 
Example #7
Source File: LocalEntityManagerFactoryBean.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Initialize the EntityManagerFactory for the given configuration.
 * @throws javax.persistence.PersistenceException in case of JPA initialization errors
 */
@Override
protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
	if (logger.isDebugEnabled()) {
		logger.debug("Building JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'");
	}
	PersistenceProvider provider = getPersistenceProvider();
	if (provider != null) {
		// Create EntityManagerFactory directly through PersistenceProvider.
		EntityManagerFactory emf = provider.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
		if (emf == null) {
			throw new IllegalStateException(
					"PersistenceProvider [" + provider + "] did not return an EntityManagerFactory for name '" +
					getPersistenceUnitName() + "'");
		}
		return emf;
	}
	else {
		// Let JPA perform its standard PersistenceProvider autodetection.
		return Persistence.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
	}
}
 
Example #8
Source File: EntityManagerBean.java    From openwebbeans-meecrowave with Apache License 2.0 6 votes vote down vote up
void init(final PersistenceUnitInfo info, final BeanManager bm) {
    final PersistenceProvider provider;
    try {
        provider = PersistenceProvider.class.cast(
                Thread.currentThread().getContextClassLoader().loadClass(info.getPersistenceProviderClassName()).newInstance());
    } catch (final InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        throw new IllegalArgumentException("Bad provider: " + info.getPersistenceProviderClassName());
    }
    final EntityManagerFactory factory = provider.createContainerEntityManagerFactory(info, new HashMap() {{
        put("javax.persistence.bean.manager", bm);
        if (ValidationMode.NONE != info.getValidationMode()) {
            ofNullable(findValidatorFactory(bm)).ifPresent(factory -> put("javax.persistence.validation.factory", factory));
        }
    }});
    instanceFactory = synchronization == SynchronizationType.SYNCHRONIZED ? factory::createEntityManager : () -> factory.createEntityManager(synchronization);
}
 
Example #9
Source File: Persistence.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public boolean isLoaded(Object entity) {
    PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver();

    List<PersistenceProvider> providers = resolver.getPersistenceProviders();

    for (PersistenceProvider provider : providers) {
        LoadState loadstate = provider.getProviderUtil().isLoaded(entity);
        if(loadstate == LoadState.LOADED) {
            return true;
        } else if (loadstate == LoadState.NOT_LOADED) {
            return false;
        } // else continue
    }
    //None of the providers could determine the load state
    return true;
}
 
Example #10
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 6 votes vote down vote up
private void guessDelegate() {
	// https://issues.apache.org/jira/browse/SIRONA-44
	// https://github.com/javamelody/javamelody/issues/460
	final List<PersistenceProvider> persistenceProviders = PersistenceProviderResolverHolder
			.getPersistenceProviderResolver().getPersistenceProviders();
	for (final PersistenceProvider persistenceProvider : persistenceProviders) {
		if (!getClass().isInstance(persistenceProvider)) {
			delegate = persistenceProvider;
			break;
		}
	}
	if (delegate == null) {
		for (final String provider : PROVIDERS) {
			try {
				delegate = newPersistence(provider);
				break;
			} catch (final Throwable th2) { // NOPMD
				continue;
			}
		}
		if (delegate == null) {
			throw new IllegalStateException(
					new ClassNotFoundException("Can't find a delegate"));
		}
	}
}
 
Example #11
Source File: LocalEntityManagerFactoryBean.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the EntityManagerFactory for the given configuration.
 * @throws javax.persistence.PersistenceException in case of JPA initialization errors
 */
@Override
protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
	if (logger.isInfoEnabled()) {
		logger.info("Building JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'");
	}
	PersistenceProvider provider = getPersistenceProvider();
	if (provider != null) {
		// Create EntityManagerFactory directly through PersistenceProvider.
		EntityManagerFactory emf = provider.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
		if (emf == null) {
			throw new IllegalStateException(
					"PersistenceProvider [" + provider + "] did not return an EntityManagerFactory for name '" +
					getPersistenceUnitName() + "'");
		}
		return emf;
	}
	else {
		// Let JPA perform its standard PersistenceProvider autodetection.
		return Persistence.createEntityManagerFactory(getPersistenceUnitName(), getJpaPropertyMap());
	}
}
 
Example #12
Source File: JpaSchemaGeneratorMojo.java    From jpa-schema-maven-plugin with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public Class<? extends PersistenceProvider> getProviderClass() {
    String vendorClassName = PROVIDER_MAP.get(vendor);
    try {
        return (Class<PersistenceProvider>) Class.forName(vendorClassName);
    } catch (ClassNotFoundException e) {
        throw new IllegalStateException("vendor class " + vendorClassName, e);
    }
}
 
Example #13
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public void generateSchema(final PersistenceUnitInfo info, final Map map) {
	final PersistenceProvider persistenceProvider = findDelegate(map);
	persistenceProvider.generateSchema(info, map);
}
 
Example #14
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public boolean generateSchema(final String persistenceUnitName, final Map map) {
	final PersistenceProvider persistenceProvider = findDelegate(map);
	return persistenceProvider.generateSchema(persistenceUnitName, map);
}
 
Example #15
Source File: TestJpa.java    From javamelody with Apache License 2.0 5 votes vote down vote up
/**
 * Test de JpaPersistence.
 */
@Test
public void testJpaPersistence() {
	final PersistenceProvider jpaPersistence = getJpaPersistence();

	final ProviderUtil providerUtil = jpaPersistence.getProviderUtil();
	assertNotNull("getProviderUtil", providerUtil);
	// providerUtil == JpaPersistence.DUMMY_PROVIDER_UTIL
	providerUtil.isLoadedWithoutReference(null, null);
	providerUtil.isLoadedWithReference(null, null);
	providerUtil.isLoaded(null);
}
 
Example #16
Source File: TestJpa.java    From javamelody with Apache License 2.0 5 votes vote down vote up
private PersistenceProvider getJpaPersistence() {
	final List<PersistenceProvider> persistenceProviders = PersistenceProviderResolverHolder
			.getPersistenceProviderResolver().getPersistenceProviders();
	for (final PersistenceProvider persistenceProvider : persistenceProviders) {
		if (persistenceProvider instanceof JpaPersistence) {
			return persistenceProvider;
		}
	}
	throw new IllegalStateException("JpaPersistence not found in PersistenceProviders");
}
 
Example #17
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public EntityManagerFactory createEntityManagerFactory(final String unit, final Map map) {
	initJpaCounter();
	final PersistenceProvider persistenceProvider = findDelegate(map);
	final ClassLoader tccl = tccl();

	final ClassLoader hack = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { // pour findbugs
		/** {@inheritDoc} */
		@Override
		public ClassLoader run() {
			return new JpaOverridePersistenceXmlClassLoader(tccl,
					persistenceProvider.getClass().getName());
		}
	});

	Thread.currentThread().setContextClassLoader(hack);
	try {
		final Map overridenMap = new HashMap();
		if (map != null) {
			overridenMap.putAll(map);
		}
		// #869 No Persistence provider for EntityManager, with Hibernate 5.4 & JPA
		// (when JpaOverridePersistenceXmlClassLoader is not enough)
		overridenMap.put(JPA_PERSISTENCE_PROVIDER, persistenceProvider.getClass().getName());
		final EntityManagerFactory entityManagerFactory = persistenceProvider
				.createEntityManagerFactory(unit, overridenMap);
		if (entityManagerFactory == null) {
			return null;
		}
		return JpaWrapper.createEntityManagerFactoryProxy(entityManagerFactory);
	} finally {
		Thread.currentThread().setContextClassLoader(tccl);
	}
}
 
Example #18
Source File: JPAPluginTest.java    From minnal with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup() {
	plugin = spy(new JPAPlugin());
	provider = mock(PersistenceProvider.class);
	persistenceUnitInfo = mock(PersistenceUnitInfo.class);
	application = mock(Application.class);
	ApplicationConfiguration configuration = mock(ApplicationConfiguration.class);
	when(configuration.getName()).thenReturn("test");
	when(configuration.getDatabaseConfiguration()).thenReturn(mock(DatabaseConfiguration.class));
	when(application.getConfiguration()).thenReturn(configuration);
	
	doReturn(persistenceUnitInfo).when(plugin).createPersistenceUnitInfo(configuration, provider);
	doReturn(Arrays.asList(provider)).when(plugin).getProviders();
}
 
Example #19
Source File: EntityManagerFactoryProvider.java    From hammock with Apache License 2.0 5 votes vote down vote up
public EntityManagerFactory lookupEntityManagerFactory(String name) {
    return entityManagerFactoryMap.computeIfAbsent(name, s -> {
        PersistenceUnitInfo persistenceUnitInfo = jpaExtension.getPersistenceUnitInfo(name);
        if (s.equals(DEFAULT_EMF) && persistenceUnitInfo == null) {
            persistenceUnitInfo = getDefaultPersistenceUnitInfo();
        }
        if (persistenceUnitInfo != null) {
            PersistenceProvider provider = getPersistenceProvider();
            return provider.createContainerEntityManagerFactory(persistenceUnitInfo, emptyMap());
        } else {
            Map<String, String> properties = ConfigLoader.loadAllProperties(createPrefix(s), true);
            return Persistence.createEntityManagerFactory(s, properties);
        }
    });
}
 
Example #20
Source File: HibernateUtil.java    From hibernate-demos with Apache License 2.0 5 votes vote down vote up
private EntityManagerFactory getEntityManagerFactory() {
	if ( emf == null ) {
		Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
		// Could get this by wiring up OsgiTestBundleActivator as well.
		BundleContext context = thisBundle.getBundleContext();

		ServiceReference serviceReference = context.getServiceReference( PersistenceProvider.class.getName() );
		PersistenceProvider persistenceProvider = (PersistenceProvider) context.getService( serviceReference );

		emf = persistenceProvider.createEntityManagerFactory( "unmanaged-jpa", null );
	}
	return emf;
}
 
Example #21
Source File: JPAPlugin.java    From minnal with Apache License 2.0 5 votes vote down vote up
public void init(Application<? extends ApplicationConfiguration> application) {
	List<PersistenceProvider> providers = getProviders();
	if (providers == null || providers.isEmpty()) {
		throw new MinnalException("No JPA persistence provider found");
	}
	PersistenceProvider provider = providers.get(0);
	PersistenceUnitInfo info = createPersistenceUnitInfo(application.getConfiguration(), provider); 
	factory = provider.createContainerEntityManagerFactory(info, null);
	JPA.instance.addPersistenceUnit(info.getPersistenceUnitName(), factory);
	application.addListener(new JerseyApplicationEventListener(application.getConfiguration().getDatabaseConfiguration()));
}
 
Example #22
Source File: JPA.java    From activejpa with Apache License 2.0 5 votes vote down vote up
private JPA() {
	List<PersistenceProvider> providers = PersistenceProviderResolverHolder.getPersistenceProviderResolver().getPersistenceProviders();
	if (providers != null) {
		String providerClass = providers.get(0).getClass().getCanonicalName();
		if (providerClass.equals(HIBERNATE_PERSISTENCE) || providerClass.equals(HIBERNATE_JPA_PERSISTENCE)) {
			cacheableHint = "org.hibernate.cacheable";
		} else if (providerClass.equals(ECLIPSE_PERSISTENCE)) {
			cacheableHint = "eclipselink.query-results-cache";
		} else if (providerClass.equals(OPENJPA_PERSISTENCE)) {
			cacheableHint = "openjpa.QueryCache";
		}
	}
}
 
Example #23
Source File: JpaPersistence.java    From javamelody with Apache License 2.0 4 votes vote down vote up
private PersistenceUnitInfo createPersistentUnitInfoProxy(final PersistenceUnitInfo info,
		final PersistenceProvider persistenceProvider) {
	final InvocationHandler invocationHandler = new ProviderAwareHandler(
			persistenceProvider.getClass().getName(), info);
	return JdbcWrapper.createProxy(info, invocationHandler);
}
 
Example #24
Source File: MavenArtifactNotifierCoreCommonJpaConfig.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
@Bean
public PersistenceProvider persistenceProvider() {
	return new InterceptorAwareHibernatePersistenceProvider();
}
 
Example #25
Source File: EntityManagerFactoryCallable.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public EntityManagerFactory call() throws Exception {
    final ClassLoader old = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(appClassLoader);
    try {
        final Class<?> clazz = appClassLoader.loadClass(persistenceProviderClassName);
        final PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance();

        // Create entity manager factories with the validator factory
        final Map<String, Object> properties = new HashMap<>();
        if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) {
            properties.put("javax.persistence.validation.factory",
                    potentialValidators != null && potentialValidators.size() == 1 ? // optim to avoid lookups
                            ensureSerializable(potentialValidators.values().iterator().next()) :
                            new ValidatorFactoryWrapper(potentialValidators));
        }
        if (cdi && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty("tomee.jpa.cdi", "true"))
                && "true".equalsIgnoreCase(SystemInstance.get().getProperty("tomee.jpa.cdi", "true"))) {
            properties.put("javax.persistence.bean.manager",
                    Proxy.newProxyInstance(appClassLoader, new Class<?>[]{BeanManager.class}, new BmHandler()));
        }

        customizeProperties(properties);

        // ensure no tx is there cause a managed connection would fail if the provider setAutocCommit(true) and some hib* have this good idea
        final Transaction transaction;
        if (unitInfo.isLazilyInitialized()) {
            transaction = OpenEJB.getTransactionManager().suspend();
        } else {
            transaction = null;
        }
        final EntityManagerFactory emf;
        try {
            emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties);
        } finally {
            if (unitInfo.isLazilyInitialized() && transaction != null) {
                OpenEJB.getTransactionManager().resume(transaction);
            }
        }

        if (unitInfo.getProperties() != null
                && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty(OPENEJB_JPA_INIT_ENTITYMANAGER))
                || SystemInstance.get().getOptions().get(OPENEJB_JPA_INIT_ENTITYMANAGER, false)) {
            emf.createEntityManager().close();
        }

        if (unitInfo.getNonJtaDataSource() != null) {
            final ImportSql importer = new ImportSql(appClassLoader, unitInfo.getPersistenceUnitName(), unitInfo.getNonJtaDataSource());
            if (importer.hasSomethingToImport()) {
                emf.createEntityManager().close(); // to let OpenJPA create the database if configured this way
                importer.doImport();
            }
        }

        return emf;
    } finally {
        Thread.currentThread().setContextClassLoader(old);
    }
}
 
Example #26
Source File: HibernateJpaVendorAdapter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public PersistenceProvider getPersistenceProvider() {
	return this.persistenceProvider;
}
 
Example #27
Source File: PersistenceUnitInfoBuilder.java    From openwebbeans-meecrowave with Apache License 2.0 4 votes vote down vote up
public PersistenceUnitInfo toInfo() {
    if (providerClass == null) {
        providerClass = ServiceLoader.load(PersistenceProvider.class).iterator().next().getClass().getName();
    }
    requireNonNull(dataSource, "datasource not provided");
    return new PersistenceUnitInfo() {
        @Override
        public String getPersistenceUnitName() {
            return unitName;
        }

        @Override
        public String getPersistenceProviderClassName() {
            return providerClass;
        }

        @Override
        public PersistenceUnitTransactionType getTransactionType() {
            return transactionType;
        }

        @Override
        public DataSource getJtaDataSource() {
            return jtaDataSource;
        }

        @Override
        public DataSource getNonJtaDataSource() {
            return dataSource;
        }

        @Override
        public List<String> getMappingFileNames() {
            return mappingFiles;
        }

        @Override
        public List<URL> getJarFileUrls() {
            return jarFiles;
        }

        @Override
        public URL getPersistenceUnitRootUrl() {
            return rootUrl;
        }

        @Override
        public List<String> getManagedClassNames() {
            return managedClasses;
        }

        @Override
        public boolean excludeUnlistedClasses() {
            return excludeUnlistedClasses;
        }

        @Override
        public SharedCacheMode getSharedCacheMode() {
            return sharedCacheMode;
        }

        @Override
        public ValidationMode getValidationMode() {
            return validationMode;
        }

        @Override
        public Properties getProperties() {
            return properties;
        }

        @Override
        public String getPersistenceXMLSchemaVersion() {
            return version;
        }

        @Override
        public ClassLoader getClassLoader() {
            return loader;
        }

        @Override
        public void addTransformer(final ClassTransformer transformer) {
            // no-op: not supported
        }

        @Override
        public ClassLoader getNewTempClassLoader() {
            return new URLClassLoader(new URL[0], Thread.currentThread().getContextClassLoader());
        }
    };
}
 
Example #28
Source File: OpenJpaVendorAdapter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public PersistenceProvider getPersistenceProvider() {
	return this.persistenceProvider;
}
 
Example #29
Source File: EclipseLinkJpaVendorAdapter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public PersistenceProvider getPersistenceProvider() {
	return this.persistenceProvider;
}
 
Example #30
Source File: AbstractEntityManagerFactoryBean.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public PersistenceProvider getPersistenceProvider() {
	return this.persistenceProvider;
}