2 * Copyright © 2017-2018 AT&T Intellectual Property.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
\r
5 * in compliance with the License. You may obtain a copy of the License at
\r
7 * http://www.apache.org/licenses/LICENSE-2.0
\r
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
\r
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
\r
11 * or implied. See the License for the specific language governing permissions and limitations under
\r
15 package org.onap.ccsdk.config.data.adaptor.dao;
\r
17 import java.util.List;
\r
18 import java.util.Map;
\r
19 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
\r
20 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
\r
22 public interface NamedQueryExecutorDao {
\r
24 * Return NamedParameterJdbcTemplate object.
\r
26 public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException;
\r
29 * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the
\r
30 * query, expecting a result list.
\r
32 * The results will be mapped to a List (one entry for each row) of Maps (one entry for each column,
\r
33 * using the column name as the key).
\r
35 * @param sql SQL query to execute
\r
36 * @param param map of parameters to bind to the query (leaving it to the PreparedStatement to guess
\r
37 * the corresponding SQL type)
\r
38 * @return a List that contains a Map per row
\r
39 * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
\r
41 public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException;
\r
44 * Issue an update via a prepared statement, binding the given arguments.
\r
46 * @param sql SQL containing named parameters
\r
47 * @param param map of parameters to bind to the query (leaving it to the PreparedStatement to guess
\r
48 * the corresponding SQL type)
\r
49 * @return the number of rows affected
\r
50 * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update
\r
52 public int update(String sql, Map<String, Object> parameters) throws SvcLogicException;
\r