在映射文件中,通过parameterType指定输入参数的类型,类型可以是简单类型、hashmap、pojo的包装类型。在测试包装类型过程中产生了一个错误:org.apache.ibatis.exceptions.PersistenceException、错误如下。
映射文件如下:
我们来看着错误提示:There is no getter for property named 'UserCustom' in 'class com.murongtech.mybatis.domain.UserQueryVo' 大致意思是在UserQueryVo类中属性UserCustom 没有相应的get方法。这里就是问题的所在了,我在SQL中使用#{UserCustom.sex},而我在UserQueryVo定义的属性是小写开头的userCustom。所以换成小写,问题就解决了。