use of org.hibernate.hql.spi.QueryTranslatorFactory 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.spi.QueryTranslatorFactory 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.spi.QueryTranslatorFactory in project hibernate-orm by hibernate.
the class EJBQLTest method toSql.
private String toSql(String hql) {
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
QueryTranslator queryTranslator = ast.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, sessionFactory(), null);
queryTranslator.compile(Collections.EMPTY_MAP, true);
return queryTranslator.getSQLString();
}
use of org.hibernate.hql.spi.QueryTranslatorFactory in project hibernate-orm by hibernate.
the class LocaleTest method testAliasWithLocale.
@Test
@TestForIssue(jiraKey = "HHH-8579")
public void testAliasWithLocale() {
// Without the HHH-8579 fix, this will generate non-ascii query aliases.
String hql = "from IAmAFoo";
QueryTranslatorFactory ast = new ASTQueryTranslatorFactory();
QueryTranslator queryTranslator = ast.createQueryTranslator(hql, hql, Collections.EMPTY_MAP, sessionFactory(), null);
queryTranslator.compile(Collections.EMPTY_MAP, false);
String sql = queryTranslator.getSQLString();
assertTrue(sql.matches(asciiRegex));
}
use of org.hibernate.hql.spi.QueryTranslatorFactory in project hibernate-orm by hibernate.
the class QueryTranslatorFactoryInitiator method initiateService.
@Override
public QueryTranslatorFactory initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
final StrategySelector strategySelector = registry.getService(StrategySelector.class);
final QueryTranslatorFactory factory = strategySelector.resolveDefaultableStrategy(QueryTranslatorFactory.class, configurationValues.get(QUERY_TRANSLATOR), ASTQueryTranslatorFactory.INSTANCE);
log.debugf("QueryTranslatorFactory : %s", factory);
if (factory instanceof ASTQueryTranslatorFactory) {
log.usingAstQueryTranslatorFactory();
}
return factory;
}
Aggregations