HHH-13742 - Missing from clause with joined inheritance property in association subquery

This commit is contained in:
Jan-Willem Gmelig Meyling 2019-11-21 15:30:41 +01:00
parent c9a373c180
commit 8089d8c575
1 changed files with 18 additions and 0 deletions

View File

@ -101,6 +101,24 @@ public class HHH13670Test extends BaseCoreFunctionalTestCase {
}); });
} }
@Test
public void testSubTypePropertyReferencedFromEntityJoinInSyntheticSubquery() {
doInJPA(this::sessionFactory, em -> {
List<Tuple> resultList = em.createQuery(
"SELECT subB_0.id, subA_0.id, subB_0.id, subA_0.id FROM SubB subB_0 INNER JOIN SubA subA_0 ON 1=1 WHERE (EXISTS (SELECT 1 FROM subB_0.parent _synth_subquery_0 WHERE subA_0.id = _synth_subquery_0.id)) ORDER BY subB_0.id ASC, subA_0.id ASC", Tuple.class)
.getResultList();
assertEquals(1, resultList.size());
});
}
@Override
protected void configure(Configuration configuration) {
super.afterConfigurationBuilt( configuration );
// Uncomment to fix tests
// configuration.setProperty( AvailableSettings.OMIT_JOIN_OF_SUPERCLASS_TABLES, "false" );
}
@Override @Override
protected Class<?>[] getAnnotatedClasses() { protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] { Super.class, SubA.class, SubB.class }; return new Class<?>[] { Super.class, SubA.class, SubB.class };