hibernate学习笔记

来源:互联网 发布:软件使用报告 编辑:程序博客网 时间:2024/06/03 09:53

1:org.hibernate.HibernateException: The database returned no natively generated identity value
要将id设为自增

2:mapping开头
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

configuration开头
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">


3:org.hibernate.hql.ast.QuerySyntaxException is not mapped
因为 Hibernate是对类查询的
在hql="from contents;中,
contents是数据库中的表,而contents对应的类是Contents.java,现在只需要将contents改为Contents就可以了


4:org.hibernate.DuplicateMappingException: Duplicate class/entity mapping
重复配置


5:hibernate-mapping中的catalog是什么意思
1.编目.
编目就是在本地或远程建立客户端到服务器的数据库连接的目的。
2. catalog 属性.
假若指定了这个属性,表名会加上所指定的catalog的名字扩展为全限定名。假若没有指定,表名就不会使用全限定名。

 

 

原创粉丝点击