use of org.hibernate.hql.internal.ast.QueryTranslatorImpl in project hibernate-orm by hibernate.
the class CollectionPropertyDeprecationsTest method compileQuery.
private QueryTranslatorImpl compileQuery(String hql) {
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
QueryTranslatorImpl newQueryTranslator = (QueryTranslatorImpl) ast.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, sessionFactory(), null);
newQueryTranslator.compile(Collections.emptyMap(), false);
return newQueryTranslator;
}
use of org.hibernate.hql.internal.ast.QueryTranslatorImpl in project hibernate-orm by hibernate.
the class QueryTranslatorTestCase method createNewQueryTranslator.
private QueryTranslatorImpl createNewQueryTranslator(String hql, Map replacements, boolean scalar, SessionFactoryImplementor factory) {
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
QueryTranslatorImpl newQueryTranslator = (QueryTranslatorImpl) ast.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, factory, null);
newQueryTranslator.compile(replacements, scalar);
return newQueryTranslator;
}
use of org.hibernate.hql.internal.ast.QueryTranslatorImpl in project hibernate-orm by hibernate.
the class HQLTest method testBogusQuery.
@Test
@TestForIssue(jiraKey = "HHH-2187")
public void testBogusQuery() {
try {
QueryTranslatorImpl translator = createNewQueryTranslator("bogus");
fail("This should have failed with a QueryException");
} catch (Throwable t) {
assertTyping(QueryException.class, t);
}
}
use of org.hibernate.hql.internal.ast.QueryTranslatorImpl in project hibernate-orm by hibernate.
the class HQLTest method testRowValueConstructorSyntaxInInList.
@Test
@RequiresDialectFeature(DialectChecks.SupportsRowValueConstructorSyntaxInInListCheck.class)
public void testRowValueConstructorSyntaxInInList() {
QueryTranslatorImpl translator = createNewQueryTranslator("from LineItem l where l.id in (?1)");
assertInExist(" 'in' should be kept, since the dialect supports this syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in ?1");
assertInExist(" 'in' should be kept, since the dialect supports this syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in (('a1',1,'b1'),('a2',2,'b2'))");
assertInExist(" 'in' should be kept, since the dialect supports this syntax", true, translator);
translator = createNewQueryTranslator("from Animal a where a.id in (?1)");
assertInExist("only translated tuple has 'in' syntax", true, translator);
translator = createNewQueryTranslator("from Animal a where a.id in ?1");
assertInExist("only translated tuple has 'in' syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in (select a1 from Animal a1 left join a1.offspring o where a1.id = 1)");
assertInExist("do not translate sub-queries", true, translator);
}
use of org.hibernate.hql.internal.ast.QueryTranslatorImpl in project hibernate-orm by hibernate.
the class EJBQLTest method compile.
private QueryTranslatorImpl compile(String input) {
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
QueryTranslator queryTranslator = ast.createQueryTranslator(input, input, Collections.EMPTY_MAP, sessionFactory(), null);
queryTranslator.compile(Collections.EMPTY_MAP, true);
return (QueryTranslatorImpl) queryTranslator;
}
Aggregations