Illegal overloaded getter method with ambiguous type for Propert error resolution

Source: Internet
Author: User


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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.