本文整理汇总了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();
}
}
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}