use of jakarta.persistence.spi.PersistenceUnitInfo in project spring-framework by spring-projects.
the class PersistenceXmlParsingTests method testMetaInfCase.
@Test
public void testMetaInfCase() throws Exception {
PersistenceUnitReader reader = new PersistenceUnitReader(new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
String resource = "/org/springframework/orm/jpa/META-INF/persistence.xml";
PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);
assertThat(info).isNotNull();
assertThat(info.length).isEqualTo(1);
assertThat(info[0].getPersistenceUnitName()).isEqualTo("OrderManagement");
assertThat(info[0].getJarFileUrls().size()).isEqualTo(2);
assertThat(info[0].getJarFileUrls().get(0)).isEqualTo(new ClassPathResource("order.jar").getURL());
assertThat(info[0].getJarFileUrls().get(1)).isEqualTo(new ClassPathResource("order-supplemental.jar").getURL());
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}
use of jakarta.persistence.spi.PersistenceUnitInfo in project spring-boot by spring-projects.
the class AbstractJpaAutoConfigurationTests method customPersistenceUnitPostProcessors.
@Test
void customPersistenceUnitPostProcessors() {
this.contextRunner.withUserConfiguration(TestConfigurationWithCustomPersistenceUnitPostProcessors.class).run((context) -> {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = context.getBean(LocalContainerEntityManagerFactoryBean.class);
PersistenceUnitInfo persistenceUnitInfo = entityManagerFactoryBean.getPersistenceUnitInfo();
assertThat(persistenceUnitInfo).isNotNull();
assertThat(persistenceUnitInfo.getManagedClassNames()).contains("customized.attribute.converter.class.name");
});
}
use of jakarta.persistence.spi.PersistenceUnitInfo in project jOOQ by jOOQ.
the class AttributeConverterExtractor method initEntityManagerFactory.
private final EntityManagerFactory initEntityManagerFactory() {
PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());
Map<String, Object> configuration = new HashMap<>();
configuration.put("hibernate.integrator_provider", integratorProvider());
configuration.put("hibernate.hbm2ddl.auto", "none");
configuration.put(AvailableSettings.CONNECTION_PROVIDER, database.connectionProvider());
PersistenceUnitInfoDescriptor descriptor = new PersistenceUnitInfoDescriptor(persistenceUnitInfo);
return new EntityManagerFactoryBuilderImpl(descriptor, configuration).build();
}
Aggregations