Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-274

Allow Multiple Resultset Queries to be appended to different lists

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • DataMapper 1.6.1
    • DataMapper 3.0
    • None
    • None

    Description

      Currently if I have a query that returns multiple resultsets, each object returned is added to a single ArrayList.

      <select id="GetMultipleResultMap" resultMap="account,category">
      select * from accounts
      select * from categories
      </select>

      IList list = sqlMap.QueryForList("GetMultipleResultMap", null);

      This will return a single list with n+m objects in it (n customers + m categories).

      I would like a way to get a list of lists. The returned object would be a list with 2 objects in it (list of n Customers, list of m categories). Which would allow for the following code.

      IList list = sqlMap.QueryForList("GetMultipleResultMap", null);
      IList<Account> accountList = (IList<Account>) list[0];
      IList<Category> categoryList = (IList<Category>) list[1];

      In order to keep backwards compatibility we would need new syntax in the resultMap attribute, possibly the following:

      <select id="GetMultipleResultMap" resultMap="account[],category[]">
      select * from accounts
      select * from categories
      </select>

      Also notice I would like the inner lists to be generic lists if possible. We can create the correct generic list type from the resultMap types.

      I posted a "quick and dirty" patch that breaks backwards compatibility on the mailing list that shows what I'm thinking.
      http://www.mail-archive.com/user-cs@ibatis.apache.org/msg02307.html

      I would be willing to code the change and submit the patch if this is something you think is worth while.

      Attachments

        Activity

          People

            gilles Gilles Bayon
            schallm Michael T. Schall
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: