Preface: Title, when there was a
Exception in thread "main" org.mybatis.spring.MyBatisSystemException:nested Exception is Org.apache.ibatis.reflection.ReflectionException:Illegal overloaded Getter method with ambiguous type for property Tradetype in class class Com.honzh.biz.database.entity.OrderBase. This breaks the JavaBeans specification and can cause unpredicatble results.
What should I do when this is wrong?
Workaround:
The above problem is because of the problem of MyBatis internal in the Java reflection, then why appear, because Java will be a Boolean getter method is the default is the beginning or get, as
public boolean isTradeType() {
}
public boolean getTradeType() {
}
The above two methods, Java will be considered to be the attributes of the bean encapsulation, then in the reflection, Java will not know which tradetype to get, if resolved, if your class has
public Integer getTradeType() {
return tradeType;
}
public boolean isTradeType() {
if (StringUtils.isEmpty(getTradeType()) || (!isBuy() && isSale())) {
return false;
}
return true;
}
Similar to the above methods exist, then pay attention to, the Boolean Istradetype method rename, such as replaced Typeoftradetype so good, Java in the reflection of the time will not distinguish between what is not clear what the property.
Illegal overloaded getter method with ambiguous type for Propert error resolution