1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.binding;
17
18 import java.util.List;
19
20 import org.apache.ibatis.annotations.Arg;
21 import org.apache.ibatis.annotations.CacheNamespace;
22 import org.apache.ibatis.annotations.ConstructorArgs;
23 import org.apache.ibatis.annotations.Flush;
24 import org.apache.ibatis.annotations.Param;
25 import org.apache.ibatis.annotations.Result;
26 import org.apache.ibatis.annotations.Results;
27 import org.apache.ibatis.annotations.Select;
28 import org.apache.ibatis.domain.blog.Author;
29 import org.apache.ibatis.domain.blog.Post;
30 import org.apache.ibatis.domain.blog.Section;
31 import org.apache.ibatis.executor.BatchResult;
32 import org.apache.ibatis.session.RowBounds;
33
34 @CacheNamespace(readWrite = false)
35 public interface BoundAuthorMapper {
36
37
38
39 List<Post> findPostsInArray(Integer[] ids);
40
41
42
43 List<Post> findPostsInList(List<Integer> ids);
44
45
46
47 int insertAuthor(Author author);
48
49 int insertAuthorInvalidSelectKey(Author author);
50
51 int insertAuthorInvalidInsert(Author author);
52
53 int insertAuthorDynamic(Author author);
54
55
56
57
58 @ConstructorArgs({
59 @Arg(column = "AUTHOR_ID", javaType = int.class)
60 })
61 @Results({
62 @Result(property = "username", column = "AUTHOR_USERNAME"),
63 @Result(property = "password", column = "AUTHOR_PASSWORD"),
64 @Result(property = "email", column = "AUTHOR_EMAIL"),
65 @Result(property = "bio", column = "AUTHOR_BIO")
66 })
67 @Select({
68 "SELECT ",
69 " ID as AUTHOR_ID,",
70 " USERNAME as AUTHOR_USERNAME,",
71 " PASSWORD as AUTHOR_PASSWORD,",
72 " EMAIL as AUTHOR_EMAIL,",
73 " BIO as AUTHOR_BIO",
74 "FROM AUTHOR WHERE ID = #{id}"})
75
76 Author selectAuthor(int id);
77
78
79
80 @Result(property = "id", column = "AUTHOR_ID", id = true)
81 @Result(property = "username", column = "AUTHOR_USERNAME")
82 @Result(property = "password", column = "AUTHOR_PASSWORD")
83 @Result(property = "email", column = "AUTHOR_EMAIL")
84 @Result(property = "bio", column = "AUTHOR_BIO")
85
86 @Select({
87 "SELECT ",
88 " ID as AUTHOR_ID,",
89 " USERNAME as AUTHOR_USERNAME,",
90 " PASSWORD as AUTHOR_PASSWORD,",
91 " EMAIL as AUTHOR_EMAIL,",
92 " BIO as AUTHOR_BIO",
93 "FROM AUTHOR WHERE ID = #{id}"})
94
95 Author selectAuthorMapToPropertiesUsingRepeatable(int id);
96
97
98
99
100 @ConstructorArgs({
101 @Arg(column = "AUTHOR_ID", javaType = Integer.class),
102 @Arg(column = "AUTHOR_USERNAME", javaType = String.class),
103 @Arg(column = "AUTHOR_PASSWORD", javaType = String.class),
104 @Arg(column = "AUTHOR_EMAIL", javaType = String.class),
105 @Arg(column = "AUTHOR_BIO", javaType = String.class),
106 @Arg(column = "AUTHOR_SECTION", javaType = Section.class)
107 })
108 @Select({
109 "SELECT ",
110 " ID as AUTHOR_ID,",
111 " USERNAME as AUTHOR_USERNAME,",
112 " PASSWORD as AUTHOR_PASSWORD,",
113 " EMAIL as AUTHOR_EMAIL,",
114 " BIO as AUTHOR_BIO,"
115 + " FAVOURITE_SECTION as AUTHOR_SECTION",
116 "FROM AUTHOR WHERE ID = #{id}"})
117
118 Author selectAuthorConstructor(int id);
119
120
121
122 @Arg(column = "AUTHOR_ID", javaType = Integer.class, id = true)
123 @Arg(column = "AUTHOR_USERNAME", javaType = String.class)
124 @Arg(column = "AUTHOR_PASSWORD", javaType = String.class)
125 @Arg(column = "AUTHOR_EMAIL", javaType = String.class)
126 @Arg(column = "AUTHOR_BIO", javaType = String.class)
127 @Arg(column = "AUTHOR_SECTION", javaType = Section.class)
128
129 @Select({
130 "SELECT ",
131 " ID as AUTHOR_ID,",
132 " USERNAME as AUTHOR_USERNAME,",
133 " PASSWORD as AUTHOR_PASSWORD,",
134 " EMAIL as AUTHOR_EMAIL,",
135 " BIO as AUTHOR_BIO,"
136 + " FAVOURITE_SECTION as AUTHOR_SECTION",
137 "FROM AUTHOR WHERE ID = #{id}"})
138
139 Author selectAuthorMapToConstructorUsingRepeatable(int id);
140
141
142
143 @Arg(column = "AUTHOR_ID", javaType = int.class)
144 @Result(property = "username", column = "AUTHOR_USERNAME")
145
146 @Select({
147 "SELECT ",
148 " ID as AUTHOR_ID,",
149 " USERNAME as AUTHOR_USERNAME,",
150 " PASSWORD as AUTHOR_PASSWORD,",
151 " EMAIL as AUTHOR_EMAIL,",
152 " BIO as AUTHOR_BIO",
153 "FROM AUTHOR WHERE ID = #{id}"})
154
155 Author selectAuthorUsingSingleRepeatable(int id);
156
157
158
159
160 @ConstructorArgs({
161 @Arg(column = "AUTHOR_ID", javaType = Integer.class),
162 @Arg(column = "AUTHOR_USERNAME", javaType = String.class),
163 @Arg(column = "AUTHOR_PASSWORD", javaType = String.class),
164 @Arg(column = "AUTHOR_EMAIL", javaType = String.class),
165 @Arg(column = "AUTHOR_BIO", javaType = String.class)
166 })
167 @Arg(column = "AUTHOR_SECTION", javaType = Section.class)
168 @Select({
169 "SELECT ",
170 " ID as AUTHOR_ID,",
171 " USERNAME as AUTHOR_USERNAME,",
172 " PASSWORD as AUTHOR_PASSWORD,",
173 " EMAIL as AUTHOR_EMAIL,",
174 " BIO as AUTHOR_BIO,"
175 + " FAVOURITE_SECTION as AUTHOR_SECTION",
176 "FROM AUTHOR WHERE ID = #{id}"})
177
178 Author selectAuthorUsingBothArgAndConstructorArgs(int id);
179
180
181
182
183 @Results(
184 @Result(property = "id", column = "AUTHOR_ID")
185 )
186 @Result(property = "username", column = "AUTHOR_USERNAME")
187 @Select({
188 "SELECT ",
189 " ID as AUTHOR_ID,",
190 " USERNAME as AUTHOR_USERNAME",
191 "FROM AUTHOR WHERE ID = #{id}"})
192
193 Author selectAuthorUsingBothResultAndResults(int id);
194
195
196
197 List<Post> findThreeSpecificPosts(@Param("one") int one, RowBounds rowBounds, @Param("two") int two, int three);
198
199 @Flush
200 List<BatchResult> flush();
201
202 }