Hibernate:HQL,转为SQL

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();

你可能感兴趣的:(Hibernate:HQL,转为SQL)