错误信息:ids for this class must be manually assigned before calling save(): sample.db.Completedsample
来源:互联网 发布:民国报纸数据库 编辑:程序博客网 时间:2024/06/13 23:12
错误信息:ids for this class must be manually assigned before calling save(): sample.db.Completedsample
原因分析:从字面上理解的意思是,在save之前,必须手动指定id,其中id的;
解决办法:将主键设为自增,原先需要主键表示的数据,重新设置一个键。此时主键id的 ;之前主键没有设为自增,将id的generator的class设为increment也是同样的效果。
资料:元素映射了相应数据库表的主键字段,对其子元素,其中class的取值可以为increment、identity、sequence、hilo、native……等,更多的可参考hibernate参考文档,一般取其值为native ;ps:我用的是MySQL,取值为native时也会报错。
http://blog.163.com/starfish_yang/blog/static/686256852010102785912790/ 这个blog中有每种class值的详解。
总结:还是没有弄清楚为何会报错,开始的时候数据库中id不是自增的,程序中也setId了,出现了如上的报错信息。使用main函数测试,非自增的情况下,是可以直接指定id值的,然后,使用网页测试,也是可以的,这个问题没有能够重现。
阅读全文
0 0
- 错误信息:ids for this class must be manually assigned before calling save(): sample.db.Completedsample
- ids for this class must be manually assigned before calling save():***错误说明
- error:ids for this class must be manually assigned before calling save():
- error:ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save()
- error:ids for this class must be manually assigned before calling save():
- ids for this class must be manually assigned before calling save() hibernate
- org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
- IdentifierGenerationException: ids for this class must be manually assigned before calling save()
- ids for this class must be manually assigned before calling save()..
- HibernateSystemException--ids for this class must be manually assigned before calling save()
- error:ids for this class must be manually assigned before calling save():
- 关于 error:ids for this class must be manually assigned before calling save(): 的解决方案
- ids for this class must be manually assigned before calling save():
- 工作札记--“ids for this class must be manually assigned before calling save”解决办法
- ids for this class must be manually assigned before calling save()..
- ids for this class must be manually assigned before calling save()
- message ids for this class must be manually assigned before calling save(): ID 的问题
- 牛顿迭代法 求 根
- Artificial Intelligence
- 进程和线程关系及区别
- 懒加载
- Java基础之正则表达式
- 错误信息:ids for this class must be manually assigned before calling save(): sample.db.Completedsample
- 理想路径,P173Uva1599
- nginx concat模块安装配置
- flask 中使用 装饰器
- Spring Cloud | 第二篇:服务消费者(Ribbon)
- html5 postMessage解决跨域、跨窗口消息传递
- java多线程 关于synchronized wait notify CountDownLatch CyclicBarrier Semaphore
- 邂逅ReactNative(二):使用Eslint规范项目代码
- Spark 2.0从入门到精通245讲——操作RDD(transformation案例实战)