[ 
https://issues.apache.org/jira/browse/IBATIS-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463550
 ] 

M.H. Avegaart commented on IBATIS-133:
--------------------------------------

I completely agree that adding support for methods and constructors is a good 
idea.

However, I have some remarks about the suggested implementation:

1. What is the signature attribute for? Reflection only needs the method name 
(name) and the parameters types (javaTypes).

2. I would choose a <constructor> element for the constructor instead of a 
<method type="constructor"> element. This would allow a DTD validator to check 
that the resultMap only contains ONE constructor.


> ResultMap Method Mapping
> ------------------------
>
>                 Key: IBATIS-133
>                 URL: https://issues.apache.org/jira/browse/IBATIS-133
>             Project: iBatis for Java
>          Issue Type: New Feature
>          Components: SQL Maps
>    Affects Versions: 2.1.0
>            Reporter: Brandon Goodin
>
> Method mapping should be supported in ibatis to map to non-javaBean methods.
> Following are some whiteboard ideas for this:
> A standard verbose mapping -
> <resultMap>
>   <method 
>     name="methodName" 
>     signature="propertyA,propertyB" 
>     javaTypes="integer,string"
>     jdbcTypes="INTEGER,VARCHAR"
>     columns="PROPERTY_A,PROPERTY_B" />
> </resultMap>
> If types map cleanly between columns and java types some configuration can be 
> avoided -
> <resultMap>
>   <method 
>     name="methodName" 
>     signature="propertyA,propertyB" 
>     columns="PROPERTY_A,PROPERTY_B" />
> </resultMap>
> column Indexes should also be supported -
> <resultMap>
>   <method 
>     name="methodName" 
>     signature="propertyA,propertyB" 
>     columnIndexes="3,8" />
> </resultMap>
> we could also use the method mapping for constructors as well. Only one 
> constructor method type can exist per resultMap. type="method" would be the 
> default unspecified method type.
> <resultMap>
>   <method
>     type="constructor" 
>     name="methodName" 
>     signature="propertyA,propertyB" 
>     columnIndexes="3,8" />
> </resultMap>
> Something else to consider is how a method signature can be mapped to both 
> complex objects and simple objects. Perhaps we need to go with a more verbose 
> mapping.
> <resultMap>
>   <method type="standard" name="methodName"> 
>     
>     
>     
>   </method>
> </resultMap>
> Not sure if we would want to support both or just one type. But, those are 
> the ideas.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to