1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.submitted.empty_row;
17
18 import java.util.Map;
19
20 import org.apache.ibatis.annotations.ResultMap;
21 import org.apache.ibatis.annotations.Select;
22
23 public interface Mapper {
24
25 @Select("select null from (values(0))")
26 String getString();
27
28 @ResultMap("parentRM")
29 @Select("select col1, col2 from parent where id = #{id}")
30 Parent getBean(Integer id);
31
32 @Select("select col1, col2 from parent where id = #{id}")
33 Map<String, String> getMap(Integer id);
34
35 @ResultMap("associationRM")
36 @Select({ "select p.id, c.name child_name from parent p",
37 "left join child c on c.parent_id = p.id where p.id = #{id}" })
38 Parent getAssociation(Integer id);
39
40 @ResultMap("associationWithNotNullColumnRM")
41 @Select({ "select p.id, c.id child_id, c.name child_name from parent p",
42 "left join child c on c.parent_id = p.id where p.id = #{id}" })
43 Parent getAssociationWithNotNullColumn(Integer id);
44
45 @ResultMap("nestedAssociationRM")
46 @Select("select 1 id, null child_name, null grandchild_name from (values(0))")
47 Parent getNestedAssociation();
48
49 @ResultMap("collectionRM")
50 @Select({ "select p.id, c.name child_name from parent p",
51 "left join child c on c.parent_id = p.id where p.id = #{id}" })
52 Parent getCollection(Integer id);
53
54 @ResultMap("twoCollectionsRM")
55
56 @Select({"select p.id, c.name child_name, e.name pet_name from parent p",
57 "left join child c on c.parent_id = p.id",
58 "left join pet e on e.parent_id = p.id", "where p.id = #{id}"})
59
60 Parent getTwoCollections(Integer id);
61
62 @Select("select col1, col2 from parent where id = #{id}")
63 ImmutableParent selectImmutable(Integer id);
64 }