hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()
这个错误是因为eclipse 
这种jpatools 自动生成的实体类内没把id 设置为自增,还有id的值在生成的时候默认为string 即使加上了也所以无法自增 ,所以还需要把string 换成Integer ,因为是自增所以无需送数,把后边的getid setid 删除掉酒可以
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
// private String id;
private Integer id;
// public Integer getId() {
// return this.id;
// }
// public void setId(String id) {
// Integer it =Integer.valueOf(id);
// //int i = it.intValue();
// this.id = it;
// }
设置自动model时



hibernate save数据的时候报错: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 ...
- ids for this class must be manually assigned before calling save():
Caused by: javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: i ...
- 报错: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());
- Hibernate: ids for this class must be manually assigned before calling save():
原文: http://blog.csdn.net/softimes/article/details/7008875 引起问题的原因: 由Hibernate根据数据库表自动生成的"类名.hbm ...
- 错误/异常:org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save() 的解决方法
1.错误/异常视图 错误/异常描述:id的生成错误,在调用save()方法之前,必须先生成id. 2.解决方法 在对应的实体类的主键(id)的get方法上加上:@GeneratedValue( ...
- ids for this class must be manually assigned before calling save():Xxx
把Xxx.hbm.xml主键生成策略改成identity
- 记一次 Hibernate 插入数据中文乱码报错解决
错误描述 程序运行,向表中插入数据(包含中文)报错:\xE6\xB2\x88\xE9\x9B\xAA... 但是自己另外新建一个数据库手动插入数据中文正常,同样修改数据库,表的编码之后同样不行.而且 ...
- assigned before calling save & JPA id生成策略
撸了今年阿里.网易和美团的面试,我有一个重要发现.......>>> Ⅰ 关于JPA 主键,自定义生成遇到的问题,愚蠢的笔记 Ⅱ 第一次 报错: ids for this class ...
随机推荐
- 1.2.2 Excel中手机号或身份证号批量加密星号
在对应的单元格中我们输入公式: =LEFT(C4,3)&"****"&RIGHT(C4,4)或=MID(C4,1,3)&"****"&a ...
- django 获取用户提交的数据 文件 表单
templates: <div> <form action="/detail" method="post" enctype="mul ...
- 把java程序作为windows服务运行
参考: https://www.jianshu.com/p/fc9e4ea61e13 https://blog.csdn.net/qq_28566071/article/details/8088250 ...
- 铁板纹理 铁锈Rust
软件:Substance Designer 2017.1.2 这篇文章记录铁锈的制作方法,铁锈效果见图一 图一:铁锈Rust 铁锈的具体制作过程为: 使用BnW Spots 2(Noise)结点生成噪 ...
- MySQL之Haproxy+Keepalived+MySQL高可用均衡负载部署 (网络摘抄)
来源于:https://blog.csdn.net/weisong530624687/article/details/71536837?utm_source=blogxgwz3 一.安装主从MySQL ...
- Java 里面各种类型之间的相互转换
1.整形与字符型之间的数据类型转换: 一.int转换成char有两种方法: ① 是利用char的unicode编码 例:int num1 = 8; char ch1 = (char) (num1 + ...
- java泛型的作用及实现原理
一.泛型的介绍 泛型是Java 1.5的新特性,泛型的本质是参数化类型,也就是说所操作的数据类型被指定为一个参数.这种参数类型可以用在类.接口和方法的创建中,分别称为泛型类.泛型接口.泛型方法. Ja ...
- win10 安全设置
风险程序: C:\Users\dong\Downloads\KMSTools_V18.06.2016_Xitongzhijia\KMSTools.exe 发起来源:C:\Windows\Syste ...
- c++之__attribute__((unused))
转自https://blog.csdn.net/u013083059/article/details/19342935 内核时注意到有些函数会有添加__attribute__((unused)), 在 ...
- [Ting's笔记Day7]活用套件carrierwave gem:(2)利用Amazon S3架设图片服务器
来到第7篇了!培养写作习惯真是不容易:) 在我的上一篇文章活用套件carrierwave gem:(1)在Rails实现图片上传功能,上传图片功能已经完成啦!但是目前图片仅能上传在自己的本地文件夹内孤 ...