摘要: 本文实验环境为MarinaDB,即MySQL开源版本 先看一下这个sql SELECT * FROM table WHERE id IN (NULL) ; 在表记录所有列都有值的情况下显然都是查不出的,那把in 改成not in是不是就能反过来查出所有记录呢? SELECT * FROM table 阅读全文
posted @ 2024-04-22 15:45 CodeSpike 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 项目中编写了几个CommandLineRunner,并且加上了spring的@order注解,期望在启动时会按顺序执行(从order的value小到大执行),但是实际使用发现排序不生效 于是进行debug,CommandLineRunner类的排序是在 SpringApplication.class 阅读全文
posted @ 2024-04-11 11:18 CodeSpike 阅读(8) 评论(0) 推荐(0) 编辑
摘要: spring框架的事务其实也是基于jdbc的事务,而一般的jdbc事务代码如下形式 try{ connection.setAutoCommit(false);//turn off autocommit transaction ...数据操作 connection.commit();//commit 阅读全文
posted @ 2022-08-05 10:54 CodeSpike 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 今天上线后看日志突然发现error暴增,赶紧看报错的内容,发现是一个NullPointException,再看定位到的代码行数,发现是一行日志,内容就是通过fastJson的toJsonString把入参实体转换为json字符串后打印出来,最后定位到的代码是这样一个方法 public Integer 阅读全文
posted @ 2022-01-18 18:07 CodeSpike 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 首先按照网上经验,添加了如下db连接参数,dbUrl=xxx&rewriteBatchedStatements=true 关于rewriteBatchedStatements这个参数介绍: MySQL的JDBC连接的url中要加rewriteBatchedStatements参数,并保证5.1.13 阅读全文
posted @ 2021-09-27 17:50 CodeSpike 阅读(970) 评论(0) 推荐(0) 编辑
摘要: ThreadLocal ThreadLocal是jdk中自带的类,用于保存本线程专有的数据,从下面的代码大家可以很直接的看到它的作用 private static ThreadLocal<String> sThreadLocal=new ThreadLocal<>(); @Test void tes 阅读全文
posted @ 2021-09-22 18:13 CodeSpike 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 目前需要优化如下一段sql: select ... from table where (`is_deleted` = 0) and( `begin_time` <= '2021-09-14 17:36:45.858' ) and( `end_time` >= '2021-09-14 17:36:45 阅读全文
posted @ 2021-09-15 14:52 CodeSpike 阅读(45) 评论(0) 推荐(0) 编辑
摘要: 首先是如下这段sql,在navicat中执行没有问题,但是程序跑起来会出现映射问题,6个字段只有前2个能够成功映射 select max(t.identification_name_encrypt) identificationName, trim(t.identification_num_encr 阅读全文
posted @ 2021-08-17 17:16 CodeSpike 阅读(779) 评论(0) 推荐(0) 编辑
摘要: 该类主要用于处理一些可能为null的变量,而同时避免写if(xx==null){..} else{..} 这类代码 首先看入口nullable /** * 可以看到Optional已经自动分配了of()/empty() */ public static <T> Optional<T> ofNulla 阅读全文
posted @ 2021-07-13 15:02 CodeSpike 阅读(1120) 评论(0) 推荐(0) 编辑
摘要: 最近调用第三方接口获取一些社交平台上爬取的信息,返回是jsonfile比较复杂 syntax error, expect {, actual string, pos 0 xxx 这个错误很明显是解析有问题,于是我debug看了字段,发现 anchorInfo这个字段又时有而有时没有 ,而正好json 阅读全文
posted @ 2021-03-08 17:28 CodeSpike 阅读(257) 评论(0) 推荐(0) 编辑
Live2D