import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.hql.ast.QueryTranslatorImpl;
QueryTranslatorImpl translator = new QueryTranslatorImpl("queryIdentifier", hql,
Collections.EMPTY_MAP, (SessionFactoryImplementor) getSessionFactory());
translator.compile(Collections.EMPTY_MAP, false);
translator.getSQLString();
原文:https://www.cnblogs.com/knowledgemine/p/12702361.html