2.3.1 throws exception for java bean specification violation (2.3.0 not)
------------------------------------------------------------------------
Key: IBATIS-501
URL: https://issues.apache.org/jira/browse/IBATIS-501
Project: iBatis for Java
Issue Type: Bug
Components: SQL Maps
Affects Versions: 2.3.1
Environment: ibatis-2.3.1.710
Reporter: Kai Grabfelder
Assume the following class com.foo.bar.Bean with the following methods:
void setFoo(int)
void setFoo(String)
int getFoo()
I'm using this bean in an implicit parameter map as a parameter to an select
statement that looks like this
<select id="getIds" parameterClass="java.util.Map"
resultClass="java.lang.Integer">
select * from dual where 1 = #bean.foo#
</select>
with the bean being a property of the map. This statement is working with
iBATIS 2.3.0 but iBATIS 2.3.1 throws the following exception when executing the
select:
Could not get property 'foo' from com.foo.bar.Bean. Cause:
java.lang.RuntimeException: Illegal overloaded setter method with ambiguous
type for property foo in class class com.foo.bar.Bean. This breaks the
JavaBeans specification and can cause unpredicatble results.
This exception makes sense when it comes to actually using the setters but as
only the getters are used I think it should not be thrown. It is perfectly ok
for me, if you consider this as won't fix, but please at least mention the
change in the release notes because it breaks backward compatibility.
See below for the relevant parts of the stacktrace
Caused by: com.ibatis.common.beans.ProbeException: Could not get property 'foo'
from com.foo.bar.Bean. Cause: java.lang.RuntimeException: Illegal overloaded
setter method with ambiguous type for property foo in class class
com.foo.bar.Bean. This breaks the JavaBeans specification and can cause
unpredicatble results.
at
com.ibatis.common.beans.ComplexBeanProbe.getProperty(ComplexBeanProbe.java:336)
at
com.ibatis.common.beans.ComplexBeanProbe.getObject(ComplexBeanProbe.java:190)
at com.ibatis.common.beans.GenericProbe.getObject(GenericProbe.java:74)
at
com.ibatis.sqlmap.engine.exchange.ComplexDataExchange.getData(ComplexDataExchange.java:65)
at
com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.getParameterObjectValues(ParameterMap.java:133)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:181)
... 30 more
Caused by: java.lang.RuntimeException: Illegal overloaded setter method with
ambiguous type for property contractYear in class class com.foo.bar.Bean. This
breaks the JavaBeans specification and can cause unpredicatble results.
at
com.ibatis.common.beans.ClassInfo.resolveSetterConflicts(ClassInfo.java:163)
at com.ibatis.common.beans.ClassInfo.addSetMethods(ClassInfo.java:141)
at com.ibatis.common.beans.ClassInfo.<init>(ClassInfo.java:76)
at com.ibatis.common.beans.ClassInfo.getInstance(ClassInfo.java:509)
at
com.ibatis.common.beans.ComplexBeanProbe.getProperty(ComplexBeanProbe.java:315)
... 35 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.