File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed
main/java/org/apache/ibatis
test/java/org/apache/ibatis/submitted/sptests Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2009-2011 The MyBatis Team
2
+ * Copyright 2009-2013 The MyBatis Team
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
23
23
@ Retention (RetentionPolicy .RUNTIME )
24
24
@ Target (ElementType .METHOD )
25
25
public @interface ResultMap {
26
- String value ();
26
+ String [] value ();
27
27
}
Original file line number Diff line number Diff line change @@ -286,7 +286,13 @@ void parseStatement(Method method) {
286
286
String resultMapId = null ;
287
287
ResultMap resultMapAnnotation = method .getAnnotation (ResultMap .class );
288
288
if (resultMapAnnotation != null ) {
289
- resultMapId = resultMapAnnotation .value ();
289
+ String [] resultMaps = resultMapAnnotation .value ();
290
+ StringBuilder sb = new StringBuilder ();
291
+ for (String resultMap : resultMaps ) {
292
+ if (sb .length () > 0 ) sb .append ("," );
293
+ sb .append (resultMap );
294
+ }
295
+ resultMapId = sb .toString ();
290
296
} else if (isSelect ) {
291
297
resultMapId = parseResultMap (method );
292
298
}
Original file line number Diff line number Diff line change @@ -89,4 +89,10 @@ public interface SPMapper {
89
89
@ ResultMap ("nameResult,itemResult" )
90
90
@ Options (statementType = StatementType .CALLABLE )
91
91
List <List <?>> getNamesAndItemsAnnotatedWithXMLResultMap ();
92
+
93
+ @ Select ("{call sptest.getnamesanditems()}" )
94
+ @ ResultMap ({"nameResult" ,"itemResult" })
95
+ @ Options (statementType = StatementType .CALLABLE )
96
+ List <List <?>> getNamesAndItemsAnnotatedWithXMLResultMapArray ();
97
+
92
98
}
Original file line number Diff line number Diff line change @@ -773,6 +773,21 @@ public void testGetNamesAndItems_a2() throws SQLException {
773
773
}
774
774
}
775
775
776
+ @ Test
777
+ public void testGetNamesAndItems_a3 () throws SQLException {
778
+ SqlSession sqlSession = sqlSessionFactory .openSession ();
779
+ try {
780
+ SPMapper spMapper = sqlSession .getMapper (SPMapper .class );
781
+
782
+ List <List <?>> results = spMapper .getNamesAndItemsAnnotatedWithXMLResultMapArray ();
783
+ assertEquals (2 , results .size ());
784
+ assertEquals (4 , results .get (0 ).size ());
785
+ assertEquals (3 , results .get (1 ).size ());
786
+ } finally {
787
+ sqlSession .close ();
788
+ }
789
+ }
790
+
776
791
@ Test
777
792
public void testGetNamesAndItemsLinked () throws SQLException {
778
793
SqlSession sqlSession = sqlSessionFactory .openSession ();
You can’t perform that action at this time.
0 commit comments