一、mybatis
Caused by: java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean()
解决方案:
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.13.7.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.3.14.RELEASE</version>
</dependency>
Q:Unknown initial character set index '224' received from server
解决方案:数据库链接URL中增加"?useUnicode=true&characterEncoding=utf8"
Q:org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1
解决方案:检查文件编码without BOM,除此之外,可能是mybatis-config.xml中的mapper路径写错了。
Q:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
解决方案:<=需要使用<=
@Select(
"<script>" +
"select " +
"business_field_id,business_field_identifier,business_field_name,business_field_comment,business_field_value,business_field_value_cn " +
"from t_a " +
"where event_id = #{eventId} " +
"and page_id = #{pageId} " +
"<if test=\"showChannelId != null and showChannelId != '' \">" +
"and show_channel_id = #{showChannelId} " +
"</if>" +
"and business_field_value_rank <= 100 " +
"order by business_field_id,business_field_value_rank " +
"</script>"
)
Q:分组元素不可重复,否则运行抛出异常
//java.lang.IllegalStateException
Map<Integer, AppPageInfo> appPageInfoMap = appPageInfoList.stream().collect(Collectors.toMap(AppPageInfo::getPageId, Function.identity()));
Q:ERROR Error 1071: Specified key was too long; max key length is 3072 bytes
https://www.cnblogs.com/jimmyfan/p/12673177.html
常见编程bug
- 表权限没有申请
- 没有将元素加入列表list +1
- mysql mapper @Param与xml不一致
- xml中的表名没有修改
- 错误返回对象中的中文名,应该返回英文名
- batchInsert传入的是空列表
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 因为在foreach里面分隔时多写了一个逗号。 +1
- 前端显示的数据缺少,需要从直接的数据表全集确认下,因为查询语句可能存在limit操作。