HIbernate 开发中遇到的错误

来源:互联网 发布:用友软件600588 编辑:程序博客网 时间:2024/05/16 05:26

 

 

错误1:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): org.hibernate.Person

如果你的主键生成方式是Assigned,你必须指定主键的值,在把事务保存提交之前!

错误2:org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update

是因为我在插入名字的时候 使用了中文 。做成  JDBC 批量更新异常!

可以插入中文,只不过我的ClassPath Oracle 数据库驱动是10G的,而我连的Oracle 9的数据库,所以造成中文无法插入的情况,后更新了  ClassPath ,解决了不能插入中文的问题。

错误3:log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).

Log4j  配置出错,原因是要把 Hibernate.cfg.xml  和log4j.properties文件放在一个目录下。就会打印信息!

原创粉丝点击