报错:

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;相关推荐

  1. 【转】 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 ...

  2. 错误信息: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 原 ...

  3. 【报错】 ids for this class must be manually assigned before calling save()

    org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before ...

  4. ids for this class must be manually assigned before calling save():Xxx

    把Xxx.hbm.xml主键生成策略改成identity 转载于:https://www.cnblogs.com/lanhj/p/4051428.html

  5. ids for this class must be manually assigned before calling save()报错解决方法

    通常报出这个错误是因为实体主键未赋值导致的,未赋值主键无法执行save()方法. 解决方法: 在实体主键上加上 @GeneratedValue(strategy = GenerationType.AU ...

  6. 错误记录(三)identity和assigned 的区别

    在使用struts+hibernate开发过程中,数据的持久化操作时出现了"org.hibernate.id.IdentifierGenerationException: ids for t ...

  7. identity和assigned 的区别

    在使用struts+hibernate开发过程中,数据的持久化操作时出现了"org.hibernate.id.IdentifierGenerationException: ids for t ...

  8. JAVA开发出现的BUG集_Java项目开发中一些BUG的总结

    1,JVM Bind 2, hbm主键生成策略错误: Struts Problem Report Struts has detected an unhandled exception: Message ...

  9. Hiernate 笔记

    目录 1.框架好处: 1 2.三大框架 1 3.Hibernate 简介: 1 4.Hibernate详细: 1 5.使用Hibernate流程,五步 1 6. 使用Hibernate操作数据库七步: ...

最新文章

  1. VC CListCtrl 第一列列宽自适应
  2. mybatis的一对一 一对多 多对多
  3. epoll 或者 kqueue 的原理是什么?
  4. 黄聪:C# 开发Chrome内核浏览器(WebKit.net)
  5. MySQL 的 count(*) 的优化,获取千万级数据表的总行数
  6. 11.2.5 属性
  7. python 文件格式转换_python实现txt文件格式转换为arff格式
  8. 周期信号的傅里叶级数表示
  9. java对mysql查询_如何利用java对mysql数据库进行增删改查
  10. hdu 1358 Period
  11. (原创)Windows系统后安装ubuntu,无法选择启动ubuntu。
  12. jenkins, docker-composer
  13. Java面向对象编程之三大特性
  14. 电磁场计算的服务器性能指标,有限公式电磁场数值计算理论与性能
  15. 软件运维监控有哪些?
  16. 从零开始学习 JD Chain(二)- JD Chain 区块链浏览器
  17. Gentoo USE参数清单中文详解
  18. 月份, 星期的英语简写
  19. 一.关于进制之间的转换关系
  20. TensorFlow : Mac Python3 TensorFlow binary was not compiled to use: AVX2 FMA

热门文章

  1. SPU、SKU、ID,它们都是什么意思,三者又有什么区别和联系呢?
  2. 解决idea在运行时出现Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8?
  3. 换手率研究精解(转载)
  4. 怎么看股票走势图(转贴)
  5. hbuilder php断点调试,Hbuilder配置php断点调试
  6. 【leetcode_1220】【困难】count-vowels-permutation / 统计元音字母序列的数目
  7. Android 使用aab 发布
  8. 计算机信息安全技术知识点简摘又名我的期末考试复习第一弹
  9. 初学Bootstrap,制作响应式布局
  10. 30个最值得去的人间仙境