Please see my recent comment added to this track.
On Sun, 13 Mar 2005 17:03:55 +0100 (CET), Clinton Begin (JIRA) <[email protected]> wrote: > [ http://issues.apache.org/jira/browse/IBATIS-45?page=history ] > > Clinton Begin closed IBATIS-45: > ------------------------------- > > Assign To: Clinton Begin > Resolution: Fixed > Fix Version: 2.1.0 > > Eliminated JavaBeanProbe and MapProbe. ComplexBeanProbe now handles all > types except DOM. > > > ProbeExceptions with complex beans > > ---------------------------------- > > > > Key: IBATIS-45 > > URL: http://issues.apache.org/jira/browse/IBATIS-45 > > Project: iBatis for Java > > Type: Bug > > Components: SQL Maps > > Versions: 2.0.8, 2.0.9 > > Environment: XP Pro; jdk 1.4.2 > > Reporter: S Boyd > > Assignee: Clinton Begin > > Fix For: 2.1.0 > > > > > When I create a resultMap that uses a complex bean that contains an > > associated Map, a ProbeException is thrown in two places when I > > attempt to populate the map from the resultset using object > > graph navigation. > > For example: > > public class Account{ > > String id; > > Map demographics; > > // setters/getters left out > > } > > <resultMap id="accountResult" class="Account"> > > <result property="id" column="id" > > /> > > <result property="demographics.address" column="address" javaType="string" > > /> > > <result property="demographics.city" column="city" javaType="string" > > /> > > <result property="demographics.state" column="state" > > /> > > </resultMap> > > The two places that ibatis will fail is during the sqlmap parsing phase > > where it uses introspection on the result properties _if_ the javaType is > > not specified. So in the resultMap above, "demographics.state" will > > generate a ProbeException because ibatis cannot determine what type "state" > > is. Of course, it is not known until runtime because the value is stored > > in the Map "demographics". Instead of a ProbeException, I think it should > > assign to the property the UnknownTypeHandler or something similar. For > > now, the current workaround would be to include the javaType attribute. > > Now, the second and more important place where the ProbeException is thrown > > is during the population of the object after the query is executed. Since > > the parent class is a java bean, the GenericProbe.setObject() method uses > > the JavaBeanProbe.setObject() which tries to force "demographics" to have a > > g/setter methods for all three properties instead of just using Map.get() > > and Map.set(). Now, if the ComplexBeanProbe.setObject() is used, then > > everything works as expected. > > Thanks, > > Stephen > > -- > This message is automatically generated by JIRA. > - > If you think it was sent incorrectly contact one of the administrators: > http://issues.apache.org/jira/secure/Administrators.jspa > - > If you want more information on JIRA, or have a bug to report see: > http://www.atlassian.com/software/jira > >
