import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.hql.ast.QueryTranslatorImpl; QueryTranslatorImpl queryTranslator=new QueryTranslatorImpl(hql,hql,Collections.EMPTY_MAP,(SessionFactoryImplementor)getSessionFactory()); queryTranslator.compile(Collections.EMPTY_MAP, false); queryTranslator.getSQLString();