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


Java PersistenceUnitInfoDescriptor类代码示例

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


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

示例1: createContainerEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
/**
 * 2017-05-24 · reworked from SpringHibernateJpaPersistenceProvider so that we can inject a custom
 * {@link EntityManagerFactoryBuilderImpl}; previous implementation that overrides
 * {@link InterceptorAwareHibernatePersistenceProvider#getEntityManagerFactoryBuilder} no longer works
 * as there are several paths with various arguments and the overloaded one was no longer called.
 */
@Override
@SuppressWarnings("rawtypes")
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties) {
	return new EntityManagerFactoryBuilderImpl(new PersistenceUnitInfoDescriptor(info), properties) {
		@Override
		protected void populate(SessionFactoryBuilder sfBuilder, StandardServiceRegistry ssr) {
			super.populate(sfBuilder, ssr);
			
			if (InterceptorAwareHibernatePersistenceProvider.this.interceptor != null) {
				LOGGER.warn("Installing our Spring managed interceptor.");
				sfBuilder.applyInterceptor(InterceptorAwareHibernatePersistenceProvider.this.interceptor);
			}
		}
	}.build();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:22,代码来源:InterceptorAwareHibernatePersistenceProvider.java

示例2: test

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
@Test
public void test() {
    PersistenceUnitInfoImpl persistenceUnitInfo = new PersistenceUnitInfoImpl(
            LongToNumericTypeTest.class.getName(),
            Collections.singletonList( Event.class.getName() ),
            validateProperties()
    );

    Map<String, Object> configuration = new HashMap<>();
    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(
            new PersistenceUnitInfoDescriptor( persistenceUnitInfo), configuration
    );
    EntityManagerFactory emf = null;
    try {
        emf = entityManagerFactoryBuilder.build();
    }
    finally {
        if ( emf != null ) {
            emf.close();
        }
    }
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:23,代码来源:LongToNumericTypeTest.java

示例3: newEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
protected EntityManagerFactory newEntityManagerFactory() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());
    Map<String, Object> configuration = new HashMap<>();
    configuration.put(AvailableSettings.INTERCEPTOR, interceptor());
    Integrator integrator = integrator();
    if (integrator != null) {
        configuration.put("hibernate.integrator_provider", (IntegratorProvider) () -> Collections.singletonList(integrator));
    }

    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(
            new PersistenceUnitInfoDescriptor(persistenceUnitInfo), configuration
    );
    return entityManagerFactoryBuilder.build();
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:15,代码来源:AbstractTest.java

示例4: newEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
protected EntityManagerFactory newEntityManagerFactory() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());
    Map<String, Object> configuration = new HashMap<String, Object>();

    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(
            new PersistenceUnitInfoDescriptor(persistenceUnitInfo), configuration
    );
    return entityManagerFactoryBuilder.build();
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:10,代码来源:AbstractTest.java

示例5: newEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
protected EntityManagerFactory newEntityManagerFactory() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());
    Map<String, Object> configuration = new HashMap<String, Object>();
    configuration.put(AvailableSettings.INTERCEPTOR, interceptor());
    Integrator integrator = integrator();

    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(
            new PersistenceUnitInfoDescriptor(persistenceUnitInfo), configuration
    );
    return entityManagerFactoryBuilder.build();
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:12,代码来源:AbstractTest.java

示例6: createEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
/**
 * TODO : cache entity manager.
 *
 * @param info
 *            the info
 * @return the entity manager factory
 */
public static EntityManagerFactory createEntityManagerFactory(PersistenceUnitInfo info) {
	

	// Map<String, Object> integrationSettings = new HashMap<>();
	// integrationSettings.put(AvailableSettings.INTERCEPTOR, new
	// JKCustomSessionFactoryInterceptor());

	PersistenceUnitInfoDescriptor puDescriptor = new PersistenceUnitInfoDescriptor(info);
	EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(puDescriptor, null);

	EntityManagerFactory emf = entityManagerFactoryBuilder.build();
	return emf;
}
 
开发者ID:kiswanij,项目名称:jk-db,代码行数:21,代码来源:JKEntityManagerFactory.java

示例7: createContainerEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties) {
	final List<String> mergedClassesAndPackages = new ArrayList<String>(info.getManagedClassNames());
	if (info instanceof SmartPersistenceUnitInfo) {
		mergedClassesAndPackages.addAll(((SmartPersistenceUnitInfo) info).getManagedPackages());
	}
	return new EntityManagerFactoryBuilderImpl(
			new PersistenceUnitInfoDescriptor(info) {
				@Override
				public List<String> getManagedClassNames() {
					return mergedClassesAndPackages;
				}
			}, properties).build();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:SpringHibernateJpaPersistenceProvider.java

示例8: entityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
@Component
public EntityManagerFactory entityManagerFactory () {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo();
    PersistenceUnitDescriptor descriptor = new PersistenceUnitInfoDescriptor(persistenceUnitInfo);
    EntityManagerFactoryBuilder entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(descriptor, null);
    return entityManagerFactoryBuilder.build();
}
 
开发者ID:ShotaOd,项目名称:carbon,代码行数:8,代码来源:HibernateConfiguration.java

示例9: newEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
protected EntityManagerFactory newEntityManagerFactory() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());
    Map<String, Object> configuration = new HashMap<>();
    configuration.put(AvailableSettings.INTERCEPTOR, interceptor());
    Integrator integrator = integrator();
    if (integrator != null) {
        configuration.put("hibernate.integrator_provider", (IntegratorProvider) () -> Collections.singletonList(integrator));
    }

    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(
        new PersistenceUnitInfoDescriptor(persistenceUnitInfo), configuration
    );
    return entityManagerFactoryBuilder.build();
}
 
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:15,代码来源:AbstractTest.java

示例10: getEntityManagerFactoryBuilderOrNull

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
@Override
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map properties, ClassLoader providedClassLoader) {

	PersistenceUnitInfo info = new RapidoidPersistenceUnitInfo(persistenceUnitName, dataSource, providedClassLoader);
	PersistenceUnitInfoDescriptor persistenceUnit = new PersistenceUnitInfoDescriptor(info);

	return emfBuilder(persistenceUnit, properties, providedClassLoader);
}
 
开发者ID:rapidoid,项目名称:rapidoid,代码行数:9,代码来源:CustomHibernatePersistenceProvider.java

示例11: newEntityManagerFactory

import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; //导入依赖的package包/类
protected EntityManagerFactory newEntityManagerFactory() {
    PersistenceUnitInfo persistenceUnitInfo = new PersistenceUnitInfoImpl(
        getClass().getSimpleName(), entityClassNames(), getProperties()
    );

    Map<String, Object> configuration = new HashMap<>();
    configuration.put(org.hibernate.jpa.AvailableSettings.INTERCEPTOR, interceptor());
    EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(
        new PersistenceUnitInfoDescriptor(persistenceUnitInfo), configuration
    );
    return entityManagerFactoryBuilder.build();
}
 
开发者ID:vladmihalcea,项目名称:hibernate-master-class,代码行数:13,代码来源:AbstractTest.java


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