@Test public void 수정쿼리_실행() { when(mappedStatement.getStatementType()).thenReturn(StatementType.UPDATE); new SqlMapQuery(queryMethod, delegate, template).execute(null); verify(template).update(namedQueryName, null); }
@Override public Object execute(Object[] parameters) { Object parameterObject = parametersParsing(parameters); if (StatementType.SELECT.equals(statementType)) { if (!queryMethod.isPageQuery() && !queryMethod.isCollectionQuery()) { return template.queryForObject(queryMethod.getNamedQueryName(), parameterObject); } else if (queryMethod.isCollectionQuery()) { return template.queryForList(queryMethod.getNamedQueryName(), parameterObject); } } else if (StatementType.INSERT.equals(statementType)) { template.insert(queryMethod.getNamedQueryName(), parameterObject); return parameterObject; } else if (StatementType.UPDATE.equals(statementType)) { return template.update(queryMethod.getNamedQueryName(), parameterObject); } else if (StatementType.DELETE.equals(statementType)) { return template.delete(queryMethod.getNamedQueryName(), parameterObject); } throw new UnsupportedOperationException(); }
SqlMapQuery implements RepositoryQuery { @Override public Object execute(Object[] parameters) { Object parameterObject = parametersParsing(parameters); if (StatementType.SELECT.equals(statementType)) { if (!queryMethod.isPageQuery() && !queryMethod.isCollectionQuery()) { return template.queryForObject(queryMethod.getNamedQueryName(), parameterObject); } else if (queryMethod.isCollectionQuery()) { return template.queryForList(queryMethod.getNamedQueryName(), parameterObject); } } else if (StatementType.INSERT.equals(statementType)) { template.insert(queryMethod.getNamedQueryName(), parameterObject); return parameterObject; } else if (StatementType.UPDATE.equals(statementType)) { return template.update(queryMethod.getNamedQueryName(), parameterObject); } else if (StatementType.DELETE.equals(statementType)) { return template.delete(queryMethod.getNamedQueryName(), parameterObject); } throw new UnsupportedOperationException(); } }
SqlMapQuery implements RepositoryQuery { @Override public Object execute(Object[] parameters) { Object parameterObject = parametersParsing(parameters); if (StatementType.SELECT.equals(statementType)) { if (!queryMethod.isPageQuery() && !queryMethod.isCollectionQuery()) { return template.queryForObject(queryMethod.getNamedQueryName(), parameterObject); } else if (queryMethod.isCollectionQuery()) { return template.queryForList(queryMethod.getNamedQueryName(), parameterObject); } } else if (StatementType.INSERT.equals(statementType)) { template.insert(queryMethod.getNamedQueryName(), parameterObject); return parameterObject; } else if (StatementType.UPDATE.equals(statementType)) { return template.update(queryMethod.getNamedQueryName(), parameterObject); } else if (StatementType.DELETE.equals(statementType)) { return template.delete(queryMethod.getNamedQueryName(), parameterObject); } throw new UnsupportedOperationException(); } SqlMapQuery(QueryMethod queryMethod, SqlMapExecutorDelegate delegate, SqlMapClientTemplate sqlMapClientTemplate); }
SqlMapQuery implements RepositoryQuery { @Override public Object execute(Object[] parameters) { Object parameterObject = parametersParsing(parameters); if (StatementType.SELECT.equals(statementType)) { if (!queryMethod.isPageQuery() && !queryMethod.isCollectionQuery()) { return template.queryForObject(queryMethod.getNamedQueryName(), parameterObject); } else if (queryMethod.isCollectionQuery()) { return template.queryForList(queryMethod.getNamedQueryName(), parameterObject); } } else if (StatementType.INSERT.equals(statementType)) { template.insert(queryMethod.getNamedQueryName(), parameterObject); return parameterObject; } else if (StatementType.UPDATE.equals(statementType)) { return template.update(queryMethod.getNamedQueryName(), parameterObject); } else if (StatementType.DELETE.equals(statementType)) { return template.delete(queryMethod.getNamedQueryName(), parameterObject); } throw new UnsupportedOperationException(); } SqlMapQuery(QueryMethod queryMethod, SqlMapExecutorDelegate delegate, SqlMapClientTemplate sqlMapClientTemplate); @Override Object execute(Object[] parameters); @Override QueryMethod getQueryMethod(); }
SqlMapQuery implements RepositoryQuery { @Override public Object execute(Object[] parameters) { Object parameterObject = parametersParsing(parameters); if (StatementType.SELECT.equals(statementType)) { if (!queryMethod.isPageQuery() && !queryMethod.isCollectionQuery()) { return template.queryForObject(queryMethod.getNamedQueryName(), parameterObject); } else if (queryMethod.isCollectionQuery()) { return template.queryForList(queryMethod.getNamedQueryName(), parameterObject); } } else if (StatementType.INSERT.equals(statementType)) { template.insert(queryMethod.getNamedQueryName(), parameterObject); return parameterObject; } else if (StatementType.UPDATE.equals(statementType)) { return template.update(queryMethod.getNamedQueryName(), parameterObject); } else if (StatementType.DELETE.equals(statementType)) { return template.delete(queryMethod.getNamedQueryName(), parameterObject); } throw new UnsupportedOperationException(); } SqlMapQuery(QueryMethod queryMethod, SqlMapExecutorDelegate delegate, SqlMapClientTemplate sqlMapClientTemplate); @Override Object execute(Object[] parameters); @Override QueryMethod getQueryMethod();  }