当前位置: 首页>>代码示例>>Java>>正文


Java PersistenceProviderResolverHolder类代码示例

本文整理汇总了Java中javax.persistence.spi.PersistenceProviderResolverHolder的典型用法代码示例。如果您正苦于以下问题:Java PersistenceProviderResolverHolder类的具体用法?Java PersistenceProviderResolverHolder怎么用?Java PersistenceProviderResolverHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PersistenceProviderResolverHolder类属于javax.persistence.spi包,在下文中一共展示了PersistenceProviderResolverHolder类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fixDeprecatedHibernateWarning

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
/**
 * fixes the warning (Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb
 * .HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.)
 *
 * must be called before getting the EntityManagerFactory
 */
private static void fixDeprecatedHibernateWarning() {
    PersistenceProviderResolverHolder.setPersistenceProviderResolver(new PersistenceProviderResolver() {
        private final List<PersistenceProvider> providers_ =
                Arrays.asList(new PersistenceProvider[]{new HibernatePersistenceProvider()});

        @Override
        public List<PersistenceProvider> getPersistenceProviders() {
            return providers_;
        }

        @Override
        public void clearCachedProviders() {

        }
    });
}
 
开发者ID:sothawo,项目名称:trakxmap,代码行数:23,代码来源:DB.java

示例2: guessDelegate

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
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"));
		}
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:27,代码来源:JpaPersistence.java

示例3: deploy

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
@Deployment
public static WebArchive deploy()
{
    // set the dummy PersistenceProviderResolver which creates our DummyEntityManagerFactory
    PersistenceProviderResolverHolder.setPersistenceProviderResolver(new TestPersistenceProviderResolver());

    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "unitDefinitionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addClass(PersistenceConfigurationProviderTest.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:17,代码来源:PersistenceConfigurationProviderTest.java

示例4: deploy

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
@Deployment
public static WebArchive deploy()
{
    // set the dummy PersistenceProviderResolver which creates our DummyEntityManagerFactory
    PersistenceProviderResolverHolder.setPersistenceProviderResolver(new TestPersistenceProviderResolver());

    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "unitDefinitionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(EntityManagerFactoryProducerTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsResource(new StringAsset(TestPersistenceProviderResolver.class.getName()),
                    "META-INF/services/javax.persistence.spi.PersistenceProviderResolver");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:19,代码来源:EntityManagerFactoryProducerTest.java

示例5: start

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
	emfResolver = new EMFBuilderServiceResolver(context);
	
	tracker = new ServiceTracker<PersistenceProvider, PersistenceProvider>(context, 
			PersistenceProvider.class, null);
	tracker.open();
	
	PersistenceProviderResolverHolder.setPersistenceProviderResolver(this);
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:11,代码来源:AriesJPASpecActivator.java

示例6: getJpaPersistence

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
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");
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:11,代码来源:TestJpa.java

示例7: JPA

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
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";
		}
	}
}
 
开发者ID:ActiveJpa,项目名称:activejpa,代码行数:14,代码来源:JPA.java

示例8: stop

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
@Override
public void stop(BundleContext context) throws Exception {
	PersistenceProviderResolverHolder.setPersistenceProviderResolver(null);
	tracker.close();
	emfResolver.close();
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:7,代码来源:AriesJPASpecActivator.java

示例9: getProviders

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
protected static List<PersistenceProvider> getProviders() {
    return PersistenceProviderResolverHolder
            .getPersistenceProviderResolver()
            .getPersistenceProviders();
}
 
开发者ID:intercommit,项目名称:hibhik,代码行数:6,代码来源:CustomPersistence.java

示例10: getPersistenceProvider

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
@Produces
@ApplicationScoped
public PersistenceProvider getPersistenceProvider() {
    return PersistenceProviderResolverHolder.getPersistenceProviderResolver().getPersistenceProviders().get(0);
}
 
开发者ID:hammock-project,项目名称:hammock,代码行数:6,代码来源:EntityManagerFactoryProvider.java

示例11: getProviders

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
protected List<PersistenceProvider> getProviders() {
	return PersistenceProviderResolverHolder.getPersistenceProviderResolver().getPersistenceProviders();
}
 
开发者ID:minnal,项目名称:minnal,代码行数:4,代码来源:JPAPlugin.java

示例12: setupClass

import javax.persistence.spi.PersistenceProviderResolverHolder; //导入依赖的package包/类
@BeforeClass
public static void setupClass() {
	System.setProperty(ECLIPSELINK_PERSISTENCEXML, "META-INF/eclipselink-plainjpa-persistence.xml");
	PersistenceProviderResolverHolder.setPersistenceProviderResolver(new EclipseLinkOnlyPersistenceProviderResolve());
	emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
}
 
开发者ID:thomasdarimont,项目名称:de.thomasdarimont.labs.jpa,代码行数:7,代码来源:EclipseLinkPlainJpaTests.java


注:本文中的javax.persistence.spi.PersistenceProviderResolverHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。