Open guan25 opened 6 years ago
追踪到mybatis里面:发现 TypeHandler 为空,对应的过滤条件是List类型(采用通用mapper generator生成的配置) --- 应该如何修改
proValue 是什么值的时候出的问题?
@abel533 是数组的时候出问题,如果是List就不会有问题,难道用Arrays.asList 引起的,但array并没有使用基本类型 谢谢
有解决方案吗,同样遇到此问题
我这边测试,只要第一次没有执行Example.Criteria 组装的条件,后面都可以查询成功,没有异常,第一次执行有条件,就可能会失败,不是必然的 @abel533
已经解决了,参数只传example对象就没问题,传list,有时会有问题,有时正常
WeekendSqls使用andIn()查询存在相同问题,更换为Example andIn()后正常
WeekendSqls使用andIn()查询存在相同问题,更换为Example andIn()后正常
Error querying database. Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_listItem_4'. It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_listItem_4'. It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
请教@abel533 后,我的问题已解决 是由于int[]被识别为类而不是数组导致的问题,改为Integer[]后解决
Error querying database. Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_listItem_3'. It was either not specified and/or could not be found for the javaType ([Ljava.lang.Integer;) : jdbcType (null) combination.
Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_listItem_3'. It was either not specified and/or could not be found for the javaType ([Ljava.lang.Integer;) : jdbcType (null) combination.] with root cause
java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_listItem_3'. It was either not specified and/or could not be found for the javaType ([Ljava.lang.Integer;) : jdbcType (null) combination. at org.apache.ibatis.mapping.ParameterMapping$Builder.validate(ParameterMapping.java:119) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.mapping.ParameterMapping$Builder.build(ParameterMapping.java:104) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.buildParameterMapping(SqlSourceBuilder.java:123) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.handleToken(SqlSourceBuilder.java:67) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.parsing.GenericTokenParser.parse(GenericTokenParser.java:78) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.builder.SqlSourceBuilder.parse(SqlSourceBuilder.java:45) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:44) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:292) ~[mybatis-3.4.6.jar:3.4.6] at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:83) ~[pagehelper-5.1.4.jar:na] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) ~[mybatis-3.4.6.jar:3.4.6] at com.sun.proxy.$Proxy176.query(Unknown Source) ~[na:na] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.6.jar:3.4.6] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.2.jar:1.3.2] at com.sun.proxy.$Proxy113.selectList(Unknown Source) ~[na:na] at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) ~[mybatis-spring-1.3.2.jar:1.3.2] at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76) ~[mybatis-3.4.6.jar:3.4.6] at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) ~[mybatis-3.4.6.jar:3.4.6] at com.sun.proxy.$Proxy122.selectByExample(Unknown Source) ~[na:na]
代码如下:=================================
for(){ ..... //拼接example,动态sql switch (type) { case EQURE: criteria.andEqualTo(columnName, proValue); break; case NOTEQURE: criteria.andNotEqualTo(columnName, proValue); break; case LIKE: if (proValue instanceof String) { criteria.andLike(columnName, "%" + proValue + "%"); } break; case RANGE:
... }
..... if (order.getOrderType().equals(FilterWrapper.ORDER_TYPE_ASC)) { if (Optional.ofNullable(orderBy).isPresent()) { orderBy = orderBy.orderBy(orderName).asc(); } else { orderBy = example.orderBy(orderName).asc(); }
..... return secondHouseMapper.selectByExample(example);