• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PersistenceProviderResolverHolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultMultipartHttpServletRequest类代码示例发布时间:2022-05-22
下一篇:
Java PDFParserConfig类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap