ids for this class must be manually assigned before calling save(): com.jia.enity.Book;
报错:
ids for this class must be manually assigned before calling save(): com.jia.enity.Book; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.jia.enity.Book
解决办法:
因为数据中的数据id是自增的,测试的时候没有写id,要在实体类上加上注解
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Testvoid save(){Book book = new Book();book.setName("spring boot");book.setAuthor("李四");Book book1 = bookRepository.save(book);System.out.println(book1);}
@Entity
@Data
public class Book {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Integer id;private String name;private String author;}
ids for this class must be manually assigned before calling save(): com.jia.enity.Book;相关推荐
- 【转】 ids for this class must be manually assigned before calling save()
[转] ids for this class must be manually assigned before calling save().. 转自:http://blog.csdn.net/sof ...
- 错误信息: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(): sample.db.Completedsample 原 ...
- 【报错】 ids for this class must be manually assigned before calling save()
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before ...
- ids for this class must be manually assigned before calling save():Xxx
把Xxx.hbm.xml主键生成策略改成identity 转载于:https://www.cnblogs.com/lanhj/p/4051428.html
- ids for this class must be manually assigned before calling save()报错解决方法
通常报出这个错误是因为实体主键未赋值导致的,未赋值主键无法执行save()方法. 解决方法: 在实体主键上加上 @GeneratedValue(strategy = GenerationType.AU ...
- 错误记录(三)identity和assigned 的区别
在使用struts+hibernate开发过程中,数据的持久化操作时出现了"org.hibernate.id.IdentifierGenerationException: ids for t ...
- identity和assigned 的区别
在使用struts+hibernate开发过程中,数据的持久化操作时出现了"org.hibernate.id.IdentifierGenerationException: ids for t ...
- JAVA开发出现的BUG集_Java项目开发中一些BUG的总结
1,JVM Bind 2, hbm主键生成策略错误: Struts Problem Report Struts has detected an unhandled exception: Message ...
- Hiernate 笔记
目录 1.框架好处: 1 2.三大框架 1 3.Hibernate 简介: 1 4.Hibernate详细: 1 5.使用Hibernate流程,五步 1 6. 使用Hibernate操作数据库七步: ...
最新文章
- VC CListCtrl 第一列列宽自适应
- mybatis的一对一 一对多 多对多
- epoll 或者 kqueue 的原理是什么?
- 黄聪:C# 开发Chrome内核浏览器(WebKit.net)
- MySQL 的 count(*) 的优化,获取千万级数据表的总行数
- 11.2.5 属性
- python 文件格式转换_python实现txt文件格式转换为arff格式
- 周期信号的傅里叶级数表示
- java对mysql查询_如何利用java对mysql数据库进行增删改查
- hdu 1358 Period
- (原创)Windows系统后安装ubuntu,无法选择启动ubuntu。
- jenkins, docker-composer
- Java面向对象编程之三大特性
- 电磁场计算的服务器性能指标,有限公式电磁场数值计算理论与性能
- 软件运维监控有哪些?
- 从零开始学习 JD Chain(二)- JD Chain 区块链浏览器
- Gentoo USE参数清单中文详解
- 月份, 星期的英语简写
- 一.关于进制之间的转换关系
- TensorFlow : Mac Python3 TensorFlow binary was not compiled to use: AVX2 FMA
热门文章
- SPU、SKU、ID,它们都是什么意思,三者又有什么区别和联系呢?
- 解决idea在运行时出现Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8?
- 换手率研究精解(转载)
- 怎么看股票走势图(转贴)
- hbuilder php断点调试,Hbuilder配置php断点调试
- 【leetcode_1220】【困难】count-vowels-permutation / 统计元音字母序列的数目
- Android 使用aab 发布
- 计算机信息安全技术知识点简摘又名我的期末考试复习第一弹
- 初学Bootstrap,制作响应式布局
- 30个最值得去的人间仙境