可以在spring配置文件中配置:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="connection.autocommit">false</prop>
<!--
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
-->
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
</props>
</property>
可以在hibernate.cfg.xml中配置:
<property name="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</property>
或者在写HQL的时候不吧中文参数拼凑进去,用query的setXxx。