该章收集工作中遇到的java bug,作为工作日志,方便回顾。
报错信息:Liquibase.exception.LockException:Could not acquire change log lock 或者 Could not acquire change log lock. Currently locked by DESKTOP-KQ19AGA (192.168.125.229) since 23-5-10 上午10:30
解决方案:
禁用 liquibase.lockservice 【但是笔者在application.yml 中写了
spring:
liquibase:
enabled: true
change-log: classpath:/db/changelog/db.changelog-master.yaml
contexts: dev,test
lockservice:
enabled: false
仍然无效,或者在pom.xml中添加以下配置来设置 JVM 参数
...
org.springframework.boot
spring-boot-maven-plugin
-Dliquibase.lockservice=false
...
也不行,不知道是不是我参数配置错误,,,】
select * from DATABASECHANGELOGLOCK;
update DATABASECHANGELOGLOCK set LOCKED=“”, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
但是sql developer中没有 DATABASECHANGELOGLOCK 表,因此使用navicat premium客户端看到有带后缀 _DATABASECHANGELOGLOCK的表,因此把所有带lock后缀的表都改1为0
select * from ACT_ADM_DATABASECHANGELOGLOCK
update ACT_ADM_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update ACT_APP_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update ACT_CMMN_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update ACT_CO_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update ACT_DE_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update ACT_DMN_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update ACT_FO_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
update FLW_EV_DATABASECHANGELOGLOCK set LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
spring cloud中,简单的sql语句:select * from t where id in(‘’,‘’) and name=''可以使用
this.query().andEq(MineGhcgZyml::getSzsbm, szs).andEq(MineGhcgZyml::getXzqbm, szq).andEq(MineGhcgZyml::getBznf, bznf).select();
this.ghfbService.query().andIn(MineGhcgGhfb::getZymlid, zymlid).select();
this指的是service层(controller\service\dto\entity);复杂的sql如下
select * from mine_ghcg_zyml where id in('d63b3a6c-e303-4319-89a3-02974117d116','b74548ed-74d6-4a9d-ae94-c48131d2688c','c7770f2d-7fdf-4c04-8a88-e8b3a6d369eb', '361818c2-a587-4148-8059-5bad68a94be0')
AND (zymlbm ='2026' or zymlbm is null)
必须使用query.and(query.condition()…)
// 资源目录表 删除szs\szq\bznf后,若除一级目录外没有其他bznf的记录则 删除一级目录
LambdaQuery query = this.query();
query.and(query.condition().andIn(MineGhcgZyml::getId, zymlid))
.and(query.condition().andEq(MineGhcgZyml::getZymlbm, String.valueOf(bznf)).orIsNull(MineGhcgZyml::getZymlbm))
.delete();
List mineGhcgZymlList3 = this.query().andEq(MineGhcgZyml::getSzsbm, szs).andEq(MineGhcgZyml::getXzqbm, szq).andIsNotNull(MineGhcgZyml::getBznf).select();
if (mineGhcgZymlList3.size() == 2) {
this.query().andIn(MineGhcgZyml::getId, zymlid).delete();
}