错误/异常:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() 的解决方法
1、错误/异常视图

错误/异常描述:id的生成错误,在调用save()方法之前,必须先生成id。
2、解决方法
在对应的实体类的主键(id)的get方法上加上:@GeneratedValue(strategy = GenerationType.AUTO) 这句话即可。括号中的值,根据你使用的数据库类型改。


|
原创作者:DSHORE 作者主页:http://www.cnblogs.com/dshore123/ 原文出自:https://www.cnblogs.com/dshore123/p/11545171.html 欢迎转载,转载务必说明出处。(如果本文对您有帮助,可以点击一下右下角的 推荐,或评论,谢谢!) |
错误/异常: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 calling save()
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before ...
- Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.qingmu.seller.entity.OrderMaster
org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before ...
- 报错:Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): cn.itcast.bos.domain.base.SubArea
因为 实体类中的主键 是String类型 不能自动为其分配id 所以需要手动设置在service层 model.setId(UUID.randomUUID().toString());
- ids for this class must be manually assigned before calling save():
Caused by: javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: i ...
- hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()
这个错误是因为eclipse 这种jpatools 自动生成的实体类内没把id 设置为自增,还有id的值在生成的时候默认为string 即使加上了也所以无法自增 ,所以还需要把string 换成In ...
- Hibernate: ids for this class must be manually assigned before calling save():
原文: http://blog.csdn.net/softimes/article/details/7008875 引起问题的原因: 由Hibernate根据数据库表自动生成的"类名.hbm ...
- ids for this class must be manually assigned before calling save():Xxx
把Xxx.hbm.xml主键生成策略改成identity
- 异常:org.hibernate.id.IdentifierGenerationException
在有关联关系的数据表中保存数据时,先保存一端,再保存多端的抛出的异常(此时不管一端,还是多端的对象都没有设置id,属性,也就是要保存的两个对象的id 属性为空.) org.hibernate.id.I ...
- org.hibernate.id.IdentifierGenerationException错误解决方法
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before ...
随机推荐
- Django初步完成:登录、注册、退出
python环境:python2.7 开发工具:pycharm 项目名称:mysite5 app名称:online settings:映射app路径 INSTALLED_APPS = [ 'djang ...
- 作业7:常用java命令(一)
一.Javac(java compiler) 1.功能:javac是一种前端编译器,负责将源代码转换为字节码. 2.例子 (1)代码 public class TestJavac { static c ...
- “007~ASP 0104~不允许操作”错误的解决方法(图解)
今天测试一个Z-Blog程序的上传文件时发现总提示“ 007~ASP 0104~不允许操作 ”的错误,经过度度上各位朋友的帮忙,终于找到解决方法. 这是windows2003 server对上传文件的 ...
- gcc/g++ 以及makefile
生成可执行文件 g++ mutiprocess.cpp -o test -fpic:产生位置无关码,位置无关码就是可以在进程的任意内存位置执行的目标码,动态链接库必须使用 -c : 只生成 .o ...
- 简单了解webservice
webservice是什么 WebService是一种跨编程语言.跨操作系统平台的远程调用技术. 远程调用技术:远程调用是指一台设备上的程序A可以调用另一台设备上的方法B. 跨编程语言:是指服务端.客 ...
- 正着打星星(js)
//让用户输入行数,使用for循环嵌套打出正着的星星来,行数等于用户输入的数字 //例如:用户输入6 // * // *** // ***** // ******* // ********* // * ...
- Idea格式化快捷键无效,没反应
Idea格式化快捷键无效,没反应 1,关闭网易云音乐快捷键 2,修改搜狗输入法快捷键 目前本人只遇到过这两种
- kbmMW均衡负载与容灾(1)
kbmMW为均衡负载与容灾提供了很好的机制,支持多种实现方式,现在看看最简单的一种,客户端控制的容灾和简单的负载均衡. 现在,我们将kbmMWServer部署到不同的服务器,或者在同一服务器部署多份实 ...
- go语言时间函数
以YY-mm-dd HH:MM:SS.9位 输出当前时间: func main() { fmt.Println(time.Now()) // 2019-11-15 16:26:12.4807588 + ...
- mybatis 动态sql 的笔记 以及标签
MyBatis常用OGNL表达式 e1 or e2 e1 and e2 e1 == e2,e1 eq e2 e1 != e2,e1 neq e2 e1 lt e2:小于 e1 lte e2:小于等于, ...