@Test
public void hhhXXXXTest() throws Exception {
try (Session s = openSession()) {
Transaction tx = s.beginTransaction();
EntityA entityA1 = new EntityA();
s.persist(entityA1);
s.flush();
Query<EntityA> query = s.createQuery(
"select c from EntityA c where c.propertyA = (select max(e.propertyA) from EntityA e where (c.reference is null and e.reference is null))",
EntityA.class);
List<EntityA> actual = query.list();
assertThat(actual).hasSize(1);
tx.commit();
}
}