ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aram Mkhitaryan (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-447) type collector definition is needed
Date Wed, 25 Jul 2007 05:40:31 GMT
type collector definition is needed

                 Key: IBATIS-447
                 URL: https://issues.apache.org/jira/browse/IBATIS-447
             Project: iBatis for Java
          Issue Type: New Feature
          Components: SQL Maps
    Affects Versions: 2.3.0
            Reporter: Aram Mkhitaryan
            Priority: Critical

I have already posted this feature/improvement in http://opensource.atlassian.com/confluence/oss/display/IBATIS/iBATIS+3.0+Whiteboard?focusedCommentId=9142285#comment-9142285

and initial problem is reported in https://issues.apache.org/jira/browse/IBATIS-446

I think this may/should be available before 3.0 is released!

The Problem:
 Yesterday I was mapping a result to the java.util.Set

<resultMap ...>
    <result ...
         javaType="java.util.Set" select="findEmployees" /> 

and got a lot of trouble because when the lazy loading was enabled the support for Set was

 and here comes suggestion ...

what if we have a new attribute "collector" or new collector handler mapping tag?

<result ...         
    javaType="java.util.Set" select="findEmployees"
    collector="myEmployeeCollector" />

<collectorHandler javaType="XXX" collector="myCollectorForXXX" />

this collector will be responsible for handling selected objects and putting in the specified
javaType object

this approach will make the code work faster, for now, when lazy loading is not enabled,
since the result objects are always collected in java.util.List and then new HashMap(list)
is called for type conversion,

as you see/know, that constructor copies values from the list, but if we have collectors for
the defined types (like TypeHandler, TypeHandlerCallback) we could add employees even in our
domain objects like office.addEmployee(employee) 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message