首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

hibernate入门配置的异常

2012-08-22 
hibernate入门配置的错误?error 1 :Context is read only???这个是不支持动态绑定。解决方法:session-fact

hibernate入门配置的错误

?

error 1 :Context is read only

?

??这个是不支持动态绑定。

解决方法:<session-factory name="java:/hibernate/HibernateFactory"> 中的 name属性去掉!

?

error 2:org.hibernate.hql.ast.QuerySyntaxException :?No expression to process!

?

这个就是关于 Hql 语句了。HQl是hibernate 查询语言,是真正面向对象的,所以当做查询的时候,就不能再出现相应的表名,而是相对的域模型。

?

举例说明:String?hql?=?"select?name?from?cate"; ?这儿要注意,from 后面的不是Table_name,而是你的你的域模型。这儿就是你的bean的对象。

?

解决方法:使用域名称。

?

error 3:hibernate.cfg.xml not found

?

解决方法:将该文件放在src下面。如果这是工程出现错误,则可以重构一下(project--->clean)(用的是Myeclipse)。

?

热点排行