Search in sources :

Example 21 with QueryTranslator

use of org.hibernate.hql.spi.QueryTranslator in project hibernate-orm by hibernate.

the class MultiInheritanceImplicitDowncastTest method testMultiJoinAddition.

private void testMultiJoinAddition(String hql) {
    final HQLQueryPlan plan = sessionFactory().getQueryPlanCache().getHQLQueryPlan(hql, false, Collections.EMPTY_MAP);
    assertEquals(1, plan.getTranslators().length);
    final QueryTranslator translator = plan.getTranslators()[0];
    final String generatedSql = translator.getSQLString();
    int sub1JoinColumnIndex = generatedSql.indexOf(".base_sub_1");
    assertNotEquals("Generated SQL doesn't contain a join for 'base' with 'PolymorphicSub1' via 'base_sub_1':\n" + generatedSql, -1, sub1JoinColumnIndex);
    int sub2JoinColumnIndex = generatedSql.indexOf(".base_sub_2");
    assertNotEquals("Generated SQL doesn't contain a join for 'base' with 'PolymorphicSub2' via 'base_sub_2':\n" + generatedSql, -1, sub2JoinColumnIndex);
}
Also used : HQLQueryPlan(org.hibernate.engine.query.spi.HQLQueryPlan) QueryTranslator(org.hibernate.hql.spi.QueryTranslator)

Aggregations

QueryTranslator (org.hibernate.hql.spi.QueryTranslator)21 Test (org.junit.Test)11 QueryTranslatorFactory (org.hibernate.hql.spi.QueryTranslatorFactory)9 ASTQueryTranslatorFactory (org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory)8 PersistentClass (org.hibernate.mapping.PersistentClass)6 RootClass (org.hibernate.mapping.RootClass)6 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)6 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)6 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)6 IQueryTranslator (org.jboss.tools.hibernate.runtime.spi.IQueryTranslator)6 HQLQueryPlan (org.hibernate.engine.query.spi.HQLQueryPlan)4 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)4 HashMap (java.util.HashMap)3 ClassicQueryTranslatorFactory (org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory)3 Map (java.util.Map)2 MappingException (org.hibernate.MappingException)2 QueryException (org.hibernate.QueryException)2 QueryTranslatorImpl (org.hibernate.hql.internal.ast.QueryTranslatorImpl)2 TestForIssue (org.hibernate.testing.TestForIssue)2 ArrayList (java.util.ArrayList)1