[ http://issues.apache.org/jira/browse/IBATIS-28?page=comments#action_12360919 ]
John Purcell commented on IBATIS-28: ------------------------------------ I would say this would be a very useful since a number of databases (MSSQL, Sybase, and now even MySQL) support this kind of feature. While I'm less concerned on how the resultMaps are assigned in the xml files (resultMap="resultMapOne,resultMap2" or a <resultMapSet> tag is fine), I think that the above suggestions to the API are a bit kludgy at best since they would envolve a huge amount of casting (at least in 1.4.x era code). Why not use what's at the heart of the API anyway: the RowHandler I'd say change queryWithRowHandler(String statementName, Object parameterOjbect, RowHandler rowHandler) to queryWithRowHandler(String statementName, Object parameterOjbect, RowHandler[] rowHandler), where each entry in the rowHandler array corresponds with each resultSet. DefaultRowHandler could be made public (as in moved to com.ibatis.sqlmap.client.event) and extended to have a getObject() method to get the first entry in the list (which is what queryForObject does anyway) and other RowHandlers could be added (such as a MapRowHandler). The above would get around some thornier aspects of using multiple resultsets. For instance, say you had a proc/select statement that returned three result sets and you wanted them to be mapped to a list, an object, and a map. The example code would be the following: <pre> DefaultRowHandler listHandler = new DefaultRowHandler(); DefaultRowHandler objectHandler = new DefaultRowHandler(); MapRowHandler mapHandler = new MapHandler("ID"); // where "ID" is the column in the resultSet that corresponds to the map key sqlMapClient.queryWithRowHandler("myProcStatemet", null, RowHandler[] { listHandler, objectHandler, mapHandler }); List myList = listHandler.getList(); Object myObject = objectHandler.getObject(); Map myMap = mapHandler.getMap(); </pre> It would, of course, be up to the user to make sure that the order of the RowHandlers are correct. queryWithRowHandler(String statementName, Object parameterOjbect, RowHandler rowHandler) would internally call queryWithRowHandler(statementName, parameterOjbect, RowHandler[] { rowHandler}) and be deprecated. Thoughts? > Support multiple results from Stored Procedures > ----------------------------------------------- > > Key: IBATIS-28 > URL: http://issues.apache.org/jira/browse/IBATIS-28 > Project: iBatis for Java > Type: Improvement > Components: SQL Maps > Versions: 2.0.8 > Environment: All > Reporter: Christopher John Gores > > It seems there is no support for multiple results being returned by a stored > procedure (i.e. statement.getMoreResults()). Unfortunately, that's a > showstopper for my new project that needs to call legacy procedures. > Suggested solution: Allow a statement to use an ordered collection of > resultMaps, either by creating a new <resultMapSet> tag, allowing <resultMap> > to nest, or by allowing the statement's resultMap attribute to hold a > comma-separated list of resultMaps. The resulting object would have to be a > List of mapped result objects. -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira