@Override
protected void configure(Configuration configuration) {
super.configure(configuration);
configuration.setProperty(AvailableSettings.SHOW_SQL, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.FORMAT_SQL, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, "10");
configuration.setProperty(AvailableSettings.USE_SECOND_LEVEL_CACHE, Boolean.TRUE.toString());
configuration.setProperty(AvailableSettings.CACHE_REGION_FACTORY, JCacheRegionFactory.class.getName());
configuration.setProperty("hibernate.javax.cache.provider", EhcacheCachingProvider.class.getName());
}
@Test
public void hhhXXXXTest() throws Exception {
Integer id = 123;
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
EntityA entityA = new EntityA();
entityA.id = id;
s.persist(entityA);
tx.commit();
}
try (Session s = openSession()) {
EntityA entityA = s.find(EntityA.class, id);
assertThat(entityA.id).isEqualTo(id);
}
try (Session s = openSession()) {
EntityB entityB = s.find(EntityB.class, id);
assertThat(entityB).isNull();
}
}