一:数据库ID自增为2的解决方法
show variables like ‘%increment%’;
如果:
auto_increment_increment=2
执行:
set @@global.auto_increment_increment = 1;
set @@auto_increment_increment =1;
如果:
auto_increment_offset=2
执行:
set @@global.auto_increment_offset =1;
set @@auto_increment_offset =1;
二: intellij debug模式提示 Method breakpoints may dramatically slow down debugging 解决办法
https://blog.youkuaiyun.com/liujiding/article/details/93046987
三:org.hibernate.TransientPropertyValueException: object references an unsaved transient instance
–》原因:
对象引用未保存的瞬态实例。这个问题之所以出现,一般在保存关联实体时。
总的来说,是因为,想把当前的实体存到另一个实体中,而另一个实体却还没有建立。所以报错。
–》解决:
先做好上一步的保存操作,保存好第一个实体,再做第二个保存。
四: java.lang.NoSuchMethodException: com.tu.pojo.Department.()

用idea练习springboot+thymeleaf项目中报错:
解决方法:
在初始化bean的时候需要无参构造器,写了有参构造器,会把无参构造器覆盖掉,需要在pojo中加上一个无参构造。
本文介绍了如何解决数据库ID自增步长为2的问题,通过设置全局变量`auto_increment_increment`和`auto_increment_offset`为1来恢复正常。同时,针对IntelliJ IDEA在Debug模式下可能出现的Method breakpoint性能影响,提供了相关解决方法链接。此外,还讨论了Hibernate中`TransientPropertyValueException`错误的原因及解决方案,强调在保存关联实体时需确保所有实体都已保存。最后,提到了Java中因缺少无参构造器导致的初始化错误,并给出了解决方案,即在Pojo类中添加无参构造函数。
889

被折叠的 条评论
为什么被折叠?



