首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hibernate的session.createQuery()方法查不到数据的解决办法

2012-11-01 
hibernate的session.createQuery()方法查不到数据的解决方法hibernate的session.createQuery()方法查不到

hibernate的session.createQuery()方法查不到数据的解决方法
hibernate的session.createQuery()方法查不到数据的解决方法
 
在Hibernate配置文件中加入下面代码:
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
如果是Spring+Hibernate开发,则在定义Hibernate配置属性时候加入:
<property name="hibernateProperties">
<props>
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
</props>
</property>


在Hibernate的配置文件 中,hibernate.query.factory_class属性用来选择查询翻译器。例如:
(1)选择Hibernate3.0的查询翻译 器:
hibernate.query.factory_class= org.hibernate.hql.ast.ASTQueryTranslatorFactory
(2)选择Hibernate2.1的查询翻 译器
hibernate.query.factory_class= org.hibernate.hql.classic.ClassicQueryTranslatorFactory

热点排行