Spring JPA 增加字段执行异常问题及解决
更新时间:2022-06-11 07:30:20 作者:佚名 我要评论(0)
目录Spring JPA 增加字段执行异常JPA自增字段自动添加报错“error performing isolated work”正确做法是使用 Spring JPA 增加字
Spring JPA 增加字段执行异常
用Spring jpa Entity里面增加了几个字段,但启动报错,提示
column Unable to execute schema management to JDBC target:
alter table qps_dictionary add column create_by varchar(10) ?'创建者';
这条语句出错。
复制语句到客户端执行,mysql果然提示语法错误,后来修改实体信息增加comment:在创建者签名增加comment即可
@Column(columnDefinition = "varchar(10) comment '创建者'",name = "create_by")
JPA自增字段自动添加报错“error performing isolated work”
在使用Jpa对数据库进行操作是时,设置的自增字段在进行插入操作时也必须set,否则会报错添加失败。
使用@GeneratedValue 注解能实现自增字段自动添加。
但是使用 @GeneratedValue 会报错 “error performing isolated work
@Id @GeneratedValue private Integer newsId;
------错误分割线-------
正确做法是使用
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer newsId;
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
- 解决springboot的JPA在Mysql8新增记录失败的问题
- 解决springjpa的局部更新字段问题
- Spring?boot?Jpa添加对象字段使用数据库默认值操作
您可能感兴趣的文章:
相关文章
Android开发EditText禁止输入监听及InputFilter字符过滤
目录??监听事件??InputFilter??监听事件 setOnEditorActionListener:软键盘回车监听事件 testEditText.setOnEditorActionListener(new Tex2022-06-11解决spring.thymeleaf.cache=false不起作用的问题
目录spring.thymeleaf.cache=false不起作用thymeleaf缓存关闭spring.thymeleaf.cache=false不起作用 配置是清除缓存,实现热部署。 也就是修2022-06-11
最新评论