首页 > 学院 > 开发设计 > 正文

hibernate 异常一

2019-11-06 07:08:12
字体:
来源:转载
供稿:网友

1、hibernate中出现 文档根元素 "hibernate-mapping" 必须匹配 DOCTYPE 根 "hibernate-configuration" 错误!

异常分析:hibernate.cfg.xml和我的userDome.hbm.xml中的表头原因 这两个的表头不是一样的修正后表头代码:hibernate.cfg.xml
<!DOCTYPE hibernate-configuration PUBLIC	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"	"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">userDome.hbm.xml
<?xml version="1.0"?><!DOCTYPE hibernate-mapping PUBLIC 	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

2、异常org.hibernate.HibernateException: The database returned no natively generated identity

异常分析:数据库的表结构中关于id,没有设置auto increment。把数据库的id设置为主键自增长即可。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表