首页 > mybatis 如何在参数映射时正确给给参数设置javaType?

mybatis 如何在参数映射时正确给给参数设置javaType?

insert into t_file(rootPathId,fileName,gender) 
  values(${rootPathId},${fileName,javaType=string},'${gender}')

如上,想给fileName指定javaType为String。执行语句时报错

Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'string' in 'class com.rayootech.entity.T_file'

问题出现在mybatis将string作为参数进行处理。
我的mybatis版本为3.3.0。
看Mybatis文档时对参数映射这一块貌似没有特殊的配置要求,不知道网友们有没有碰到这种情况,有的话怎么解决的?


找到原因了,这里应该使用#{}而不是${}……

【热门文章】
【热门文章】