use of org.hibernate.query.hql.spi.SqmQueryImplementor in project hibernate-orm by hibernate.
the class HqlEntityGraphTest method buildSqlSelectAst.
private <T> SelectStatement buildSqlSelectAst(Class<T> entityType, String hql, RootGraphImplementor<T> entityGraph, GraphSemantic mode, SessionImplementor session) {
final LoadQueryInfluencers loadQueryInfluencers = new LoadQueryInfluencers(session.getSessionFactory());
final QueryImplementor<T> query = session.createQuery(hql, entityType);
final SqmQueryImplementor<String> hqlQuery = (SqmQueryImplementor<String>) query;
hqlQuery.applyGraph(entityGraph, mode);
final SqmSelectStatement<String> sqmStatement = (SqmSelectStatement<String>) hqlQuery.getSqmStatement();
final StandardSqmTranslator<SelectStatement> sqmConverter = new StandardSqmTranslator<>(sqmStatement, hqlQuery.getQueryOptions(), ((QuerySqmImpl<?>) hqlQuery).getDomainParameterXref(), query.getParameterBindings(), loadQueryInfluencers, session.getSessionFactory(), true);
final SqmTranslation<SelectStatement> sqmInterpretation = sqmConverter.translate();
return sqmInterpretation.getSqlAst();
}
Aggregations