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.db.sqlmap.RowHandler;
  20. import org.springframework.dao.DataAccessException;
  21. /**
  22. * Interface that specifies a basic set of iBATIS SqlMap operations.
  23. * Implemented by SqlMapTemplate. Not often used, but a useful option
  24. * to enhance testability, as it can easily be mocked or stubbed.
  25. *
  26. * <p>Provides SqlMapTemplate's convenience methods that mirror MappedStatement's
  27. * executeXXX methods. See the MappedStatement javadocs for details on those methods.
  28. *
  29. * <p>NOTE: The SqlMap/MappedStatement API is the one to use with iBATIS SQL Maps 1.x.
  30. * The SqlMapClient/SqlMapSession API is only available with SQL Maps 2.
  31. *
  32. * @author Juergen Hoeller
  33. * @since 05.02.2004
  34. * @see SqlMapTemplate
  35. * @see com.ibatis.db.sqlmap.MappedStatement
  36. */
  37. public interface SqlMapOperations {
  38. Object executeQueryForObject(String statementName, Object parameterObject)
  39. throws DataAccessException;
  40. Object executeQueryForObject(String statementName, Object parameterObject,
  41. Object resultObject) throws DataAccessException;
  42. List executeQueryForList(String statementName, Object parameterObject)
  43. throws DataAccessException;
  44. List executeQueryForList(String statementName, Object parameterObject,
  45. int skipResults, int maxResults)
  46. throws DataAccessException;
  47. Map executeQueryForMap(String statementName, Object parameterObject,
  48. String keyProperty) throws DataAccessException;
  49. Map executeQueryForMap(String statementName, Object parameterObject,
  50. String keyProperty, String valueProperty);
  51. void executeQueryWithRowHandler(String statementName, Object parameterObject,
  52. RowHandler rowHandler) throws DataAccessException;
  53. int executeUpdate(String statementName, Object parameterObject)
  54. throws DataAccessException;
  55. }