1. /*
  2. * Copyright 2002-2004 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. package org.springframework.orm.ibatis;
  17. import java.util.List;
  18. import java.util.Map;
  19. import com.ibatis.common.util.PaginatedList;
  20. import com.ibatis.sqlmap.client.event.RowHandler;
  21. import org.springframework.dao.DataAccessException;
  22. /**
  23. * Interface that specifies a basic set of iBATIS SqlMapClient operations.
  24. * Implemented by SqlMapClientTemplate. Not often used, but a useful option
  25. * to enhance testability, as it can easily be mocked or stubbed.
  26. *
  27. * <p>Provides SqlMapClientTemplate's convenience methods that mirror SqlMapSession's
  28. * execution methods. See the SqlMapSession javadocs for details on those methods.
  29. *
  30. * <p>NOTE: The SqlMapClient/SqlMapSession API is the API of iBATIS SQL Maps 2.
  31. * With SQL Maps 1.x, the SqlMap/MappedStatement API has to be used.
  32. *
  33. * @author Juergen Hoeller
  34. * @since 24.02.2004
  35. * @see SqlMapClientTemplate
  36. * @see com.ibatis.sqlmap.client.SqlMapClient
  37. */
  38. public interface SqlMapClientOperations {
  39. Object queryForObject(String statementName, Object parameterObject) throws DataAccessException;
  40. Object queryForObject(String statementName, Object parameterObject, Object resultObject)
  41. throws DataAccessException;
  42. List queryForList(String statementName, Object parameterObject) throws DataAccessException;
  43. List queryForList(String statementName, Object parameterObject, int skipResults,
  44. int maxResults) throws DataAccessException;
  45. void queryWithRowHandler(String statementName, Object parameterObject, RowHandler rowHandler)
  46. throws DataAccessException;
  47. /**
  48. * @deprecated
  49. */
  50. List queryForList(String statementName, Object parameterObject, RowHandler rowHandler)
  51. throws DataAccessException;
  52. PaginatedList queryForPaginatedList(String statementName, Object parameterObject, int pageSize)
  53. throws DataAccessException;
  54. Map queryForMap(String statementName, Object parameterObject, String keyProperty)
  55. throws DataAccessException;
  56. Map queryForMap(String statementName, Object parameterObject, String keyProperty,
  57. String valueProperty) throws DataAccessException;
  58. Object insert(String statementName, Object parameterObject) throws DataAccessException;
  59. int update(String statementName, Object parameterObject) throws DataAccessException;
  60. int delete(String statementName, Object parameterObject) throws DataAccessException;
  61. }