KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > orm > ibatis > SqlMapClientOperations


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.orm.ibatis;
18
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import com.ibatis.common.util.PaginatedList;
23 import com.ibatis.sqlmap.client.event.RowHandler;
24
25 import org.springframework.dao.DataAccessException;
26
27 /**
28  * Interface that specifies a basic set of iBATIS SqlMapClient operations,
29  * implemented by {@link SqlMapClientTemplate}. Not often used, but a useful
30  * option to enhance testability, as it can easily be mocked or stubbed.
31  *
32  * <p>Defines SqlMapClientTemplate's convenience methods that mirror
33  * the iBATIS {@link com.ibatis.sqlmap.client.SqlMapExecutor}'s execution
34  * methods. Users are strongly encouraged to read the iBATIS javadocs
35  * for details on the semantics of those methods.
36  *
37  * @author Juergen Hoeller
38  * @since 24.02.2004
39  * @see SqlMapClientTemplate
40  * @see com.ibatis.sqlmap.client.SqlMapClient
41  * @see com.ibatis.sqlmap.client.SqlMapExecutor
42  */

43 public interface SqlMapClientOperations {
44
45     /**
46      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForObject(String)
47      * @throws org.springframework.dao.DataAccessException in case of errors
48      */

49     Object JavaDoc queryForObject(String JavaDoc statementName) throws DataAccessException;
50
51     /**
52      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForObject(String, Object)
53      * @throws org.springframework.dao.DataAccessException in case of errors
54      */

55     Object JavaDoc queryForObject(String JavaDoc statementName, Object JavaDoc parameterObject)
56             throws DataAccessException;
57
58     /**
59      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForObject(String, Object, Object)
60      * @throws org.springframework.dao.DataAccessException in case of errors
61      */

62     Object JavaDoc queryForObject(String JavaDoc statementName, Object JavaDoc parameterObject, Object JavaDoc resultObject)
63             throws DataAccessException;
64
65     /**
66      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String)
67      * @throws org.springframework.dao.DataAccessException in case of errors
68      */

69     List JavaDoc queryForList(String JavaDoc statementName) throws DataAccessException;
70
71     /**
72      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String, Object)
73      * @throws org.springframework.dao.DataAccessException in case of errors
74      */

75     List JavaDoc queryForList(String JavaDoc statementName, Object JavaDoc parameterObject)
76             throws DataAccessException;
77
78     /**
79      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String, int, int)
80      * @throws org.springframework.dao.DataAccessException in case of errors
81      */

82     List JavaDoc queryForList(String JavaDoc statementName, int skipResults, int maxResults)
83             throws DataAccessException;
84
85     /**
86      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForList(String, Object, int, int)
87      * @throws org.springframework.dao.DataAccessException in case of errors
88      */

89     List JavaDoc queryForList(String JavaDoc statementName, Object JavaDoc parameterObject, int skipResults, int maxResults)
90             throws DataAccessException;
91
92     /**
93      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryWithRowHandler(String, RowHandler)
94      * @throws org.springframework.dao.DataAccessException in case of errors
95      */

96     void queryWithRowHandler(String JavaDoc statementName, RowHandler rowHandler)
97             throws DataAccessException;
98
99     /**
100      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryWithRowHandler(String, Object, RowHandler)
101      * @throws org.springframework.dao.DataAccessException in case of errors
102      */

103     void queryWithRowHandler(String JavaDoc statementName, Object JavaDoc parameterObject, RowHandler rowHandler)
104             throws DataAccessException;
105
106     /**
107      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForPaginatedList(String, int)
108      * @deprecated as of iBATIS 2.3.0
109      * @throws org.springframework.dao.DataAccessException in case of errors
110      */

111     PaginatedList queryForPaginatedList(String JavaDoc statementName, int pageSize)
112             throws DataAccessException;
113
114     /**
115      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForPaginatedList(String, Object, int)
116      * @deprecated as of iBATIS 2.3.0
117      * @throws org.springframework.dao.DataAccessException in case of errors
118      */

119     PaginatedList queryForPaginatedList(String JavaDoc statementName, Object JavaDoc parameterObject, int pageSize)
120             throws DataAccessException;
121
122     /**
123      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForMap(String, Object, String)
124      * @throws org.springframework.dao.DataAccessException in case of errors
125      */

126     Map JavaDoc queryForMap(String JavaDoc statementName, Object JavaDoc parameterObject, String JavaDoc keyProperty)
127             throws DataAccessException;
128
129     /**
130      * @see com.ibatis.sqlmap.client.SqlMapExecutor#queryForMap(String, Object, String, String)
131      * @throws org.springframework.dao.DataAccessException in case of errors
132      */

133     Map JavaDoc queryForMap(String JavaDoc statementName, Object JavaDoc parameterObject, String JavaDoc keyProperty, String JavaDoc valueProperty)
134             throws DataAccessException;
135
136     /**
137      * @see com.ibatis.sqlmap.client.SqlMapExecutor#insert(String)
138      * @throws org.springframework.dao.DataAccessException in case of errors
139      */

140     Object JavaDoc insert(String JavaDoc statementName) throws DataAccessException;
141
142     /**
143      * @see com.ibatis.sqlmap.client.SqlMapExecutor#insert(String, Object)
144      * @throws org.springframework.dao.DataAccessException in case of errors
145      */

146     Object JavaDoc insert(String JavaDoc statementName, Object JavaDoc parameterObject) throws DataAccessException;
147
148     /**
149      * @see com.ibatis.sqlmap.client.SqlMapExecutor#update(String)
150      * @throws org.springframework.dao.DataAccessException in case of errors
151      */

152     int update(String JavaDoc statementName) throws DataAccessException;
153
154     /**
155      * @see com.ibatis.sqlmap.client.SqlMapExecutor#update(String, Object)
156      * @throws org.springframework.dao.DataAccessException in case of errors
157      */

158     int update(String JavaDoc statementName, Object JavaDoc parameterObject) throws DataAccessException;
159
160     /**
161      * Convenience method provided by Spring: execute an update operation
162      * with an automatic check that the update affected the given required
163      * number of rows.
164      * @param statementName the name of the mapped statement
165      * @param parameterObject the parameter object
166      * @param requiredRowsAffected the number of rows that the update is
167      * required to affect
168      * @throws org.springframework.dao.DataAccessException in case of errors
169      */

170     void update(String JavaDoc statementName, Object JavaDoc parameterObject, int requiredRowsAffected)
171             throws DataAccessException;
172
173     /**
174      * @see com.ibatis.sqlmap.client.SqlMapExecutor#delete(String)
175      * @throws org.springframework.dao.DataAccessException in case of errors
176      */

177     int delete(String JavaDoc statementName) throws DataAccessException;
178
179     /**
180      * @see com.ibatis.sqlmap.client.SqlMapExecutor#delete(String, Object)
181      * @throws org.springframework.dao.DataAccessException in case of errors
182      */

183     int delete(String JavaDoc statementName, Object JavaDoc parameterObject) throws DataAccessException;
184
185     /**
186      * Convenience method provided by Spring: execute a delete operation
187      * with an automatic check that the delete affected the given required
188      * number of rows.
189      * @param statementName the name of the mapped statement
190      * @param parameterObject the parameter object
191      * @param requiredRowsAffected the number of rows that the delete is
192      * required to affect
193      * @throws org.springframework.dao.DataAccessException in case of errors
194      */

195     void delete(String JavaDoc statementName, Object JavaDoc parameterObject, int requiredRowsAffected)
196             throws DataAccessException;
197
198 }
199
Popular Tags