@Test public void testQueryWithMissingMapParams() { MappingSqlQuery<Integer> query = new MappingSqlQuery<Integer>() { @Override protected Integer mapRow(ResultSet rs, int rownum) throws SQLException { return rs.getInt(1); } }; query.setDataSource(dataSource); query.setSql(SELECT_ID_WHERE); query.declareParameter(new SqlParameter(COLUMN_NAMES[0], COLUMN_TYPES[0])); query.declareParameter(new SqlParameter(COLUMN_NAMES[1], COLUMN_TYPES[1])); query.compile(); thrown.expect(InvalidDataAccessApiUsageException.class); query.executeByNamedParam(Collections.singletonMap(COLUMN_NAMES[0], "value")); }
@Test public void testQueryWithoutEnoughParams() { MappingSqlQuery<Integer> query = new MappingSqlQuery<Integer>() { @Override protected Integer mapRow(ResultSet rs, int rownum) throws SQLException { return rs.getInt(1); } }; query.setDataSource(dataSource); query.setSql(SELECT_ID_WHERE); query.declareParameter(new SqlParameter(COLUMN_NAMES[0], COLUMN_TYPES[0])); query.declareParameter(new SqlParameter(COLUMN_NAMES[1], COLUMN_TYPES[1])); query.compile(); thrown.expect(InvalidDataAccessApiUsageException.class); query.execute(); }
readConfiguration.declareParameter(new SqlParameter("pluginVersion", Types.VARCHAR)); readConfiguration.declareParameter(new SqlParameter("name", Types.VARCHAR)); readConfiguration.compile(); readConfigurations.declareParameter(new SqlParameter("pluginId", Types.VARCHAR)); readConfigurations.declareParameter(new SqlParameter("pluginVersion", Types.VARCHAR)); readConfigurations.compile(); readActiveConfiguration.declareParameter(new SqlParameter("tenantId", Types.INTEGER)); readActiveConfiguration.declareParameter(new SqlParameter("assocTypeId", Types.INTEGER)); readActiveConfiguration.compile();
QUERY_GET_ITEMIDS.declareParameter(new SqlParameter("tenantId2", Types.INTEGER)); QUERY_GET_ITEMIDS.declareParameter(new SqlParameter("item2TypeId", Types.INTEGER)); QUERY_GET_ITEMIDS.compile();
getRunningTenants.compile();