You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Kai Grabfelder (JIRA)" <ib...@incubator.apache.org> on 2008/04/15 13:41:05 UTC

[jira] Created: (IBATIS-501) 2.3.1 throws exception for java bean specification violation (2.3.0 not)

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.


[jira] Closed: (IBATIS-501) 2.3.1 throws exception for java bean specification violation (2.3.0 not)

Posted by "Clinton Begin (JIRA)" <ib...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/IBATIS-501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clinton Begin closed IBATIS-501.
--------------------------------

       Resolution: Won't Fix
    Fix Version/s: 2.3.2
         Assignee: Clinton Begin

Added to the release notes

> 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
>            Assignee: Clinton Begin
>             Fix For: 2.3.2
>
>
> 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.