读书人

一个hibernate错误处理

发布时间: 2012-09-04 14:19:30 作者: rapoo

一个hibernate异常处理

在自己搭建hibernate应用的过程中,碰到了如下的一个异常情况

org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/pccw/dylan/demo/entity/User.hbm.xml
?at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
?at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
?at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)

?

当碰到上述异常时,我们应该检查如下几种可能导致此异常出现的情况

1、检查hbm文件是否路径正确。

2、检查hibernate.cfg.xml文件中的对应的hbm文件路径是否正确。

3、检查hbm文件中实体对象与entity中的实体属性字段是否对应。

?

?

读书人网 >软件架构设计

热点推荐