Hibernate.cfg.xml配置文件配置错误出现的问题
来源:互联网 发布:php连接mssql 编辑:程序博客网 时间:2024/05/18 00:06
1.把配置多对一关系的语句中_和 - 写错误了:正确:<many-to-one name="depart" column="depart_id" />,错误配置:<many-to-one name="depart" column="depart - id" />。sql语句中字段可以用_但是不能用—!!害得我找这个错误找了一天。
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [cw.ok.hibernate.bean.Employee]
Caused by:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-id) values ('?????‰', 2)' at line 1
2.配置信息是正确的,但是我把实体类中的id字段的属性的类型设置成String类型了,id应该是int 类型的。private int id ;
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [cw.ok.hibernate.bean.Department]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'bbs.department' doesn't exist
3. 配置map集合的时候不map-key中type=“string” 写成了大写的String;报错!
<map name="employees">
<key column="depart_id" />
<map-key type="string" column="name" />
<one-to-many class="EmployeeList"/>
</map>
Caused by: org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(name)]
4.配置hibernate.cfg.xml文件时,若配置的实体xml文件时,两文件名一样,包名是另一个子包;会报错~,程序不知道去父包中,还是子包中的配置文件;
<mapping resource="cw/ok/hibernate/bean/extend/Department.hbm.xml" />
<mapping resource="cw/ok/hibernate/bean/extend/Employee.hbm.xml" />
<mapping resource="cw/ok/hibernate/bean/extend/Employee.hbm.xml" />
<mapping resource="cw/ok/hibernate/bean/Department.hbm.xml" />
<mapping resource="cw/ok/hibernate/bean/Employee.hbm.xml" />
<mapping resource="cw/ok/hibernate/bean/Employee.hbm.xml" />
- Hibernate.cfg.xml配置文件配置错误出现的问题
- Spring对hibernate配置文件hibernate.cfg.xml的集成,来取代hibernate.cfg.xml的配置
- Spring对hibernate配置文件hibernate.cfg.xml的集成,来取代hibernate.cfg.xml的配置
- Hibernate配置文件hibernate.cfg.xml的数据库连接配置
- hibernate配置文件hibernate.cfg.xml安全线程的session配置
- hibernate.cfg.xml文件的配置问题
- 【配置文件】MySQL的hibernate.cfg.xml配置文件
- hibernate的hibernate.cfg.xml配置文件
- 深入Hibernate 的配置文件hibernate.cfg.xml
- Hibernate的配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate配置文件hibernate.cfg.xml的详解
- hibernate.cfg.xml 配置文件
- 关于linux的ulimit
- [每日一题] OCP1z0-047 :2013-08-03 约束―――延迟约束....................................................23
- SRM587 (div2)
- web.py学习之模板
- 从排序开始(五) 堆排序
- Hibernate.cfg.xml配置文件配置错误出现的问题
- Problem 7:10001st prime
- MSDN帮助文档中关于内联函数学习笔记
- 黑客十五年:寻找被黑金毁掉的黑客精神
- QEventLoop 的使用两例
- 庞果英雄会——回文字符串
- 获取硬件信息(cpuid,硬盘id,ip地址,mac地址,pc类型)
- jQuery 基本语法
- poj3460&hdu1685Booksort(IDA*)