Closed chengbaobao630 closed 8 years ago
Before mybatis 3.3.1, SqlProvider has providerTakesParameterObject
.
After mybatis 3.4.0, SqlProvider remove providerTakesParameterObject
, and add a new field named providerMethodArgumentNames.
try {
//先针对3.3.1和之前版本做判断
this.providerTakesParameterObject = (Boolean) metaObject.getValue("providerTakesParameterObject");
} catch (ReflectionException e) {
//3.4.0+版本,解决#102 by Ian Lim
providerMethodArgumentNames = (String[]) metaObject.getValue("providerMethodArgumentNames");
}
In PageSqlProviderSqlSource, use providerTakesParameterObject to recognition mybatis version, and run different createSqlSource method.
private SqlSource createSqlSource(Object parameterObject) {
if(providerTakesParameterObject != null){
return createSqlSource331(parameterObject);
} else {
return createSqlSource340(parameterObject);
}
}
what version of mybatis do you use?
3.4.0
i have fixed it after upgrade my pagehelper version to 4.1.5,thanks.
when i use pagehelper and annotation Sqlprovider
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'providerTakesParameterObject' in 'class org.apache.ibatis.builder.annotation.ProviderSqlSource'
i find field providerTakesParameterObject in class PageProviderSqlSource ,but not in use