Hibernate3中将指定的HQL语句转换成SQL语句

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();
原文地址:https://www.cnblogs.com/liuxin-listenx/p/3227281.html