Spring Boot JPA问题:could not read a hi value

曾经终败给现在 2022-03-28 09:16 283阅读 0赞

Spring Boot JPA问题:could not read a hi value

问题

could not read a hi value

解决办法

查看工程中数据库实体类的注解

  1. @Entity
  2. @Data
  3. @Table(name = "user")
  4. public class User {
  5. @Id
  6. @GeneratedValue
  7. private Long id;
  8. private Integer age;
  9. private String name;
  10. @Column(name = "create_time")
  11. private Date createTime;
  12. }

修改注解:

  1. @GeneratedValue

  1. @GeneratedValue(strategy = GenerationType.AUTO)

改为:

  1. @GeneratedValue(strategy = GenerationType.IDENTITY)

修改后的结果:

  1. @Entity
  2. @Data
  3. @Table(name = "user")
  4. public class User {
  5. @Id
  6. @GeneratedValue(strategy = GenerationType.IDENTITY)
  7. private Long id;
  8. private Integer age;
  9. private String name;
  10. @Column(name = "create_time")
  11. private Date createTime;
  12. }

重启,问题解决。

发表评论

表情:
评论列表 (有 0 条评论,283人围观)

还没有评论,来说两句吧...

相关阅读