org.hibernate.id.IdentifierGenerationException:我的第一个hibernate异常
来源:互联网 发布:java因式分解 编辑:程序博客网 时间:2024/05/17 22:42
今天hibernate已经开课了,刚写了一个小练习,就出现了一个异常,现在分享如下:
异常信息:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
异常原因:
<id>元素配置不正确,
<id>元素缺少其子元素<generator></generator>的配置。
解决方法:<id>元素映射了相应数据库表的主键字段,对其子元素<generator class="">,其中class的取值可以为increment、identity、sequence、hilo、native......等,更多的可参考hibernate参考文档,一般取其值为native 。
MySQL:identity,increment,hilo,native.
SQL Server:identity,increment,hilo,native.
Oracle:sequence,seqhilo,increment,native.
跨平台开发:native.
native将字段管理交给数据库自己定义。
http://www.cnblogs.com/rong2009/archive/2009/08/14/1546305.html
上面的内容和标题都是来自网上, 其实这个也是我在学习hibernate中第一次遇到的异常。
- org.hibernate.id.IdentifierGenerationException:我的第一个hibernate异常
- org.hibernate.id.IdentifierGenerationException异常
- org.hibernate.id.IdentifierGenerationException:
- org.hibernate.id.IdentifierGenerationException
- org.hibernate.id.IdentifierGenerationException
- org.hibernate.id.IdentifierGenerationException
- org.hibernate.id.IdentifierGenerationException错误提示
- org.hibernate.id.IdentifierGenerationException错误解析
- org.hibernate.id.IdentifierGenerationException错误解决方法
- Exception in thread "main" org.hibernate.id.IdentifierGenerationException:
- Hibernate报错:org.hibernate.id.IdentifierGenerationException:ids for this class must be manually assig
- org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property
- hibernate异常:org.hibernate.id.…
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before
- viewgroup浅析
- 排列问题
- <每日一句英语> 2012-9-25
- 邂逅-------秋天的童话
- 中断四
- org.hibernate.id.IdentifierGenerationException:我的第一个hibernate异常
- 在servlet和非servlet实体类中如何读取资源文件
- ie8 window.open 打开窗口带滚动条
- Linux下多进程/多线程编程
- peter-bochs调试器安装方法
- Windows Shell 学习笔记一:PIDL(The Struture of the Shell)
- mysql分页 与jdbc分页
- 异步连接字符串
- 让你反思的几句话,有正确有错误!