@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, "2");
}
@Test
public void hhhXXXXTest() throws Exception {
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
EntityB entityB = new EntityB();
entityB.foo = 123;
s.persist(entityB);
EntityA entityA1 = new EntityA();
entityA1.entityB = entityB;
s.persist(entityA1);
s.flush();
s.clear();
tx.commit();
Query<MyPojo> query2 = s.createQuery(
"select new org.hibernate.bugs.MyPojo(t) from EntityA t where t.id = " + entityA1.id, MyPojo.class);
MyPojo pojo = query2.uniqueResult();
assertThat(pojo.getFoo()).isEqualTo(123);
}
}