Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
DataMapper 1.6.1
-
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.