mirror of
https://github.com/valitydev/db-common-lib.git
synced 2024-11-06 00:25:21 +00:00
Ignore unknown field (#9)
This commit is contained in:
parent
abcd6f0e91
commit
33c3a92f5b
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -8,6 +8,6 @@ build('db-common-lib', 'docker-host') {
|
||||
javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy")
|
||||
}
|
||||
|
||||
def buildImageTag = "b04c5291d101132e53e578d96e1628d2e6dab0c0"
|
||||
def buildImageTag = "917afcdd0c0a07bf4155d597bbba72e962e1a34a"
|
||||
javaLibPipeline(buildImageTag)
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 5cb25f049c719a608276a99fc4fbe852187019ca
|
||||
Subproject commit a7655bc60c877a65cdfe3d9b668021d970d88a76
|
4
pom.xml
4
pom.xml
@ -13,7 +13,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<artifactId>db-common-lib</artifactId>
|
||||
<version>0.0.3</version>
|
||||
<version>0.0.4</version>
|
||||
|
||||
<name>db-common-lib</name>
|
||||
<description>Abstract dao and row mappers</description>
|
||||
@ -61,7 +61,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
<version>2.3.0.RELEASE</version>
|
||||
<version>2.5.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -12,23 +12,32 @@ public interface GenericDao {
|
||||
|
||||
<T> T fetchOne(Query query, Class<T> type) throws DaoException;
|
||||
|
||||
<T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
<T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException;
|
||||
|
||||
<T> T fetchOne(Query query, RowMapper<T> rowMapper) throws DaoException;
|
||||
|
||||
<T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException;
|
||||
|
||||
<T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
<T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException;
|
||||
|
||||
<T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
<T> T fetchOne(String namedSql,
|
||||
SqlParameterSource parameterSource,
|
||||
RowMapper<T> rowMapper,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
|
||||
<T> List<T> fetch(Query query, RowMapper<T> rowMapper) throws DaoException;
|
||||
|
||||
<T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException;
|
||||
|
||||
<T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
<T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException;
|
||||
|
||||
<T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
<T> List<T> fetch(String namedSql,
|
||||
SqlParameterSource parameterSource,
|
||||
RowMapper<T> rowMapper,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
|
||||
void executeOne(Query query) throws DaoException;
|
||||
|
||||
@ -42,7 +51,8 @@ public interface GenericDao {
|
||||
|
||||
int execute(Query query, int expectedRowsAffected) throws DaoException;
|
||||
|
||||
int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException;
|
||||
|
||||
int execute(String namedSql) throws DaoException;
|
||||
|
||||
@ -50,31 +60,48 @@ public interface GenericDao {
|
||||
|
||||
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected) throws DaoException;
|
||||
|
||||
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
int execute(String namedSql,
|
||||
SqlParameterSource parameterSource,
|
||||
int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
|
||||
int execute(Query query, KeyHolder keyHolder) throws DaoException;
|
||||
|
||||
int execute(Query query, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException;
|
||||
|
||||
int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException;
|
||||
int execute(Query query,
|
||||
int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate,
|
||||
KeyHolder keyHolder) throws DaoException;
|
||||
|
||||
int execute(String namedSql, KeyHolder keyHolder) throws DaoException;
|
||||
|
||||
int execute(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder) throws DaoException;
|
||||
|
||||
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException;
|
||||
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, KeyHolder keyHolder)
|
||||
throws DaoException;
|
||||
|
||||
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException;
|
||||
int execute(String namedSql,
|
||||
SqlParameterSource parameterSource,
|
||||
int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate,
|
||||
KeyHolder keyHolder) throws DaoException;
|
||||
|
||||
long batchExecute(List<Query> queries) throws DaoException;
|
||||
|
||||
long batchExecute(List<Query> queries, int expectedRowsPerQueryAffected) throws DaoException;
|
||||
|
||||
long batchExecute(List<Query> queries, int expectedRowsPerQueryAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
long batchExecute(List<Query> queries,
|
||||
int expectedRowsPerQueryAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
|
||||
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources) throws DaoException;
|
||||
|
||||
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsPerQueryAffected) throws DaoException;
|
||||
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsPerQueryAffected)
|
||||
throws DaoException;
|
||||
|
||||
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsPerQueryAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
long batchExecute(String namedSql,
|
||||
List<SqlParameterSource> parameterSources,
|
||||
int expectedRowsPerQueryAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
|
||||
}
|
||||
|
@ -45,7 +45,8 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
public <T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException {
|
||||
return fetchOne(query, new SingleColumnRowMapper<>(type), namedParameterJdbcTemplate);
|
||||
}
|
||||
|
||||
@ -55,17 +56,21 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException {
|
||||
public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper)
|
||||
throws DaoException {
|
||||
return fetchOne(namedSql, parameterSource, rowMapper, getNamedParameterJdbcTemplate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
return fetchOne(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper, namedParameterJdbcTemplate);
|
||||
public <T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException {
|
||||
return fetchOne(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper,
|
||||
namedParameterJdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
try {
|
||||
return namedParameterJdbcTemplate.queryForObject(
|
||||
namedSql,
|
||||
@ -85,17 +90,24 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException {
|
||||
public <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper)
|
||||
throws DaoException {
|
||||
return fetch(namedSql, parameterSource, rowMapper, getNamedParameterJdbcTemplate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
return fetch(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper, namedParameterJdbcTemplate);
|
||||
public <T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException {
|
||||
return fetch(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper,
|
||||
namedParameterJdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
public <T> List<T> fetch(
|
||||
String namedSql,
|
||||
SqlParameterSource parameterSource,
|
||||
RowMapper<T> rowMapper,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
try {
|
||||
return namedParameterJdbcTemplate.query(
|
||||
namedSql,
|
||||
@ -123,7 +135,8 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeOne(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder) throws DaoException {
|
||||
public void executeOne(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder)
|
||||
throws DaoException {
|
||||
execute(namedSql, parameterSource, 1, keyHolder);
|
||||
}
|
||||
|
||||
@ -138,8 +151,10 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected, namedParameterJdbcTemplate);
|
||||
public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
|
||||
throws DaoException {
|
||||
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected,
|
||||
namedParameterJdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -153,19 +168,22 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected) throws DaoException {
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected)
|
||||
throws DaoException {
|
||||
return execute(namedSql, parameterSource, expectedRowsAffected, getNamedParameterJdbcTemplate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
try {
|
||||
int rowsAffected = namedParameterJdbcTemplate.update(
|
||||
namedSql,
|
||||
parameterSource);
|
||||
|
||||
if (expectedRowsAffected != -1 && rowsAffected != expectedRowsAffected) {
|
||||
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected, rowsAffected);
|
||||
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected,
|
||||
rowsAffected);
|
||||
}
|
||||
return rowsAffected;
|
||||
} catch (NestedRuntimeException ex) {
|
||||
@ -180,12 +198,15 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
|
||||
@Override
|
||||
public int execute(Query query, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException {
|
||||
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected, getNamedParameterJdbcTemplate(), keyHolder);
|
||||
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected,
|
||||
getNamedParameterJdbcTemplate(), keyHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException {
|
||||
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected, namedParameterJdbcTemplate, keyHolder);
|
||||
public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate,
|
||||
KeyHolder keyHolder) throws DaoException {
|
||||
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected,
|
||||
namedParameterJdbcTemplate, keyHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -199,12 +220,14 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException {
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected,
|
||||
KeyHolder keyHolder) throws DaoException {
|
||||
return execute(namedSql, parameterSource, expectedRowsAffected, getNamedParameterJdbcTemplate(), keyHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException {
|
||||
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException {
|
||||
try {
|
||||
int rowsAffected = namedParameterJdbcTemplate.update(
|
||||
namedSql,
|
||||
@ -212,7 +235,8 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
keyHolder);
|
||||
|
||||
if (expectedRowsAffected != -1 && rowsAffected != expectedRowsAffected) {
|
||||
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected, rowsAffected);
|
||||
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected,
|
||||
rowsAffected);
|
||||
}
|
||||
return rowsAffected;
|
||||
} catch (NestedRuntimeException ex) {
|
||||
@ -231,14 +255,17 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public long batchExecute(List<Query> queries, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
public long batchExecute(List<Query> queries,
|
||||
int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
AtomicLong affectedRowCounter = new AtomicLong();
|
||||
queries.stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(
|
||||
query -> query.getSQL(ParamType.NAMED),
|
||||
LinkedHashMap::new,
|
||||
Collectors.mapping(query -> toSqlParameterSource(query.getParams()), Collectors.toList())
|
||||
Collectors
|
||||
.mapping(query -> toSqlParameterSource(query.getParams()), Collectors.toList())
|
||||
)
|
||||
)
|
||||
.forEach(
|
||||
@ -261,17 +288,21 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
|
||||
}
|
||||
|
||||
@Override
|
||||
public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected) throws DaoException {
|
||||
public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected)
|
||||
throws DaoException {
|
||||
return batchExecute(namedSql, parameterSources, expectedRowsAffected, getNamedParameterJdbcTemplate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected,
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
|
||||
try {
|
||||
int[] rowsPerBatchAffected = namedParameterJdbcTemplate.batchUpdate(namedSql, parameterSources.toArray(new SqlParameterSource[0]));
|
||||
int[] rowsPerBatchAffected = namedParameterJdbcTemplate
|
||||
.batchUpdate(namedSql, parameterSources.toArray(new SqlParameterSource[0]));
|
||||
|
||||
if (rowsPerBatchAffected.length != parameterSources.size()) {
|
||||
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, parameterSources.size(), rowsPerBatchAffected.length);
|
||||
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, parameterSources.size(),
|
||||
rowsPerBatchAffected.length);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
@ -32,11 +32,13 @@ public class RecordRowMapper<T> implements RowMapper<T> {
|
||||
String columnName = rsMetaData.getColumnName(column);
|
||||
Field field = record.field(columnName);
|
||||
|
||||
if (field != null) {
|
||||
Object value = getFieldValue(field, resultSet);
|
||||
if (!resultSet.wasNull()) {
|
||||
record.set(field, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return record.into(type);
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,9 @@ public class AbstractGenericDaoTest {
|
||||
@Test
|
||||
public void batchExecuteTest() {
|
||||
final NamedParameterJdbcTemplate namedParameterJdbcTemplateMock = mock(NamedParameterJdbcTemplate.class);
|
||||
int[] rowPerBatchAffected = { 1, 1 };
|
||||
when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class))).thenReturn(rowPerBatchAffected);
|
||||
int[] rowPerBatchAffected = {1, 1};
|
||||
when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class)))
|
||||
.thenReturn(rowPerBatchAffected);
|
||||
when(testDaoSpy.getNamedParameterJdbcTemplate()).thenReturn(namedParameterJdbcTemplateMock);
|
||||
|
||||
final Map<String, Param<?>> firstParamMap = paramMapMock("testString", "testValue", String.class);
|
||||
@ -59,8 +60,9 @@ public class AbstractGenericDaoTest {
|
||||
@Test(expected = DaoException.class)
|
||||
public void batchExceptionTest() {
|
||||
final NamedParameterJdbcTemplate namedParameterJdbcTemplateMock = mock(NamedParameterJdbcTemplate.class);
|
||||
int[] rowPerBatchAffected = { 1 };
|
||||
when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class))).thenReturn(rowPerBatchAffected);
|
||||
int[] rowPerBatchAffected = {1};
|
||||
when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class)))
|
||||
.thenReturn(rowPerBatchAffected);
|
||||
when(testDaoSpy.getNamedParameterJdbcTemplate()).thenReturn(namedParameterJdbcTemplateMock);
|
||||
|
||||
final Map<String, Param<?>> firstParamMap = paramMapMock("testString", "testValue", String.class);
|
||||
|
Loading…
Reference in New Issue
Block a user