本文整理汇总了Java中org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl类的典型用法代码示例。如果您正苦于以下问题:Java EntityManagerFactoryBuilderImpl类的具体用法?Java EntityManagerFactoryBuilderImpl怎么用?Java EntityManagerFactoryBuilderImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityManagerFactoryBuilderImpl类属于org.hibernate.jpa.boot.internal包,在下文中一共展示了EntityManagerFactoryBuilderImpl类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContainerEntityManagerFactory
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的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.EntityManagerFactoryBuilderImpl; //导入依赖的package包/类
protected static EntityManagerFactoryBuilderImpl getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<String, Object> properties, ClassLoader providedClassLoader) {
final Map<String, Object> integration = wrap( properties );
final List<ParsedPersistenceXmlDescriptor> units;
try {
units = PersistenceXmlParser.locatePersistenceUnits( integration );
}
catch (Exception e) {
throw new PersistenceException( "Unable to locate persistence units", e );
}
if ( persistenceUnitName == null && units.size() > 1 ) {
throw new PersistenceException( "No name provided and multiple persistence units found" );
}
for ( ParsedPersistenceXmlDescriptor persistenceUnit : units ) {
final boolean matches = persistenceUnitName == null || persistenceUnit.getName().equals( persistenceUnitName );
if ( !matches ) {
continue;
}
// See if we (Hibernate) are the persistence provider
if ( ! ProviderChecker.isProvider( persistenceUnit, properties ) ) {
continue;
}
return getEntityManagerFactoryBuilder( persistenceUnit, integration, providedClassLoader );
}
return null;
}
示例11: getConfiguration
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; //导入依赖的package包/类
protected static Configuration getConfiguration(String unitName){
EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = getEntityManagerFactoryBuilderOrNull(unitName, null);
ServiceRegistry serviceRegistry = entityManagerFactoryBuilder.buildServiceRegistry();
Configuration config = entityManagerFactoryBuilder.buildHibernateConfiguration(serviceRegistry);
return config;
}
示例12: newEntityManagerFactory
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; //导入依赖的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();
}
示例13: getEntityManagerFactoryBuilder
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; //导入依赖的package包/类
protected static EntityManagerFactoryBuilderImpl getEntityManagerFactoryBuilder(PersistenceUnitDescriptor persistenceUnitDescriptor,
Map<String, Object> integration, ClassLoader providedClassLoader) {
return new EntityManagerFactoryBuilderImpl( persistenceUnitDescriptor, integration, providedClassLoader );
}