use of org.hibernate.hql.spi.QueryTranslator in project hibernate-orm by hibernate.
the class EJBQLTest method assertEjbqlEqualsHql.
private void assertEjbqlEqualsHql(String ejbql, String hql) {
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
QueryTranslator queryTranslator = ast.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, sessionFactory(), null);
queryTranslator.compile(Collections.EMPTY_MAP, true);
String hqlSql = queryTranslator.getSQLString();
queryTranslator = ast.createQueryTranslator(ejbql, ejbql, Collections.EMPTY_MAP, sessionFactory(), null);
queryTranslator.compile(Collections.EMPTY_MAP, true);
String ejbqlSql = queryTranslator.getSQLString();
assertEquals(hqlSql, ejbqlSql);
}
use of org.hibernate.hql.spi.QueryTranslator 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;
}
use of org.hibernate.hql.spi.QueryTranslator in project hibernate-orm by hibernate.
the class HQLTest method compileWithAstQueryTranslator.
private void compileWithAstQueryTranslator(String hql, boolean scalar) {
Map replacements = new HashMap();
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
SessionFactoryImplementor factory = getSessionFactoryImplementor();
QueryTranslator newQueryTranslator = ast.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, factory, null);
newQueryTranslator.compile(replacements, scalar);
}
use of org.hibernate.hql.spi.QueryTranslator in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateQueryTranslator.
@Test
public void testCreateQueryTranslator() {
QueryTranslator queryTranslator = (QueryTranslator) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { QueryTranslator.class }, new TestInvocationHandler());
IQueryTranslator facade = facadeFactory.createQueryTranslator(queryTranslator);
Assert.assertSame(queryTranslator, ((IFacade) facade).getTarget());
}
use of org.hibernate.hql.spi.QueryTranslator in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateQueryTranslator.
@Test
public void testCreateQueryTranslator() {
QueryTranslator queryTranslator = (QueryTranslator) Proxy.newProxyInstance(facadeFactory.getClassLoader(), new Class[] { QueryTranslator.class }, new TestInvocationHandler());
IQueryTranslator facade = facadeFactory.createQueryTranslator(queryTranslator);
Assert.assertSame(queryTranslator, ((IFacade) facade).getTarget());
}
Aggregations