use of org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor in project robo4j by Robo4J.
the class PersistenceContextBuilder method build.
public PersistenceContextBuilder build() {
PersistenceDescriptorFactory persistenceDescriptorFactory = new PersistenceDescriptorFactory();
PersistenceUnitInfo persistenceUnitInfo = persistenceDescriptorFactory.get(RoboClassLoader.getInstance().getClassLoader(), sourceType, packages);
PersistenceUnitDescriptor persistenceUnitDescriptor = new PersistenceUnitInfoDescriptor(persistenceUnitInfo);
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilderImpl(persistenceUnitDescriptor, new HashMap<>());
registeredClasses = persistenceDescriptorFactory.registeredClasses();
dataSourceContext = new DataSourceProxy(builder.build());
return this;
}
use of org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor in project hibernate-orm by hibernate.
the class BootstrapTest method test_bootstrap_bootstrap_native_EntityManagerFactory_example.
@Test
public void test_bootstrap_bootstrap_native_EntityManagerFactory_example() {
try {
//tag::bootstrap-native-EntityManagerFactory-example[]
String persistenceUnitName = "CRM";
List<String> entityClassNames = new ArrayList<>();
Properties properties = new Properties();
PersistenceUnitInfoImpl persistenceUnitInfo = new PersistenceUnitInfoImpl(persistenceUnitName, entityClassNames, properties);
Map<String, Object> integrationSettings = new HashMap<>();
integrationSettings.put(AvailableSettings.INTERCEPTOR, new CustomSessionFactoryInterceptor());
EntityManagerFactoryBuilderImpl entityManagerFactoryBuilder = new EntityManagerFactoryBuilderImpl(new PersistenceUnitInfoDescriptor(persistenceUnitInfo), integrationSettings);
EntityManagerFactory emf = entityManagerFactoryBuilder.build();
//end::bootstrap-native-EntityManagerFactory-example[]
} catch (Exception ignore) {
}
}
Aggregations