@Test @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) public void test_find_by_invalid_id_should_return_null() { InstrumentVoucherEntity instrumentVoucherEntity = InstrumentVoucherEntity.builder().id("5").build(); instrumentVoucherEntity.setTenantId("default"); InstrumentVoucherEntity result = instrumentVoucherJdbcRepository.findById(instrumentVoucherEntity); assertNull(result); }
public InstrumentVoucherEntity findById(InstrumentVoucherEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); List<InstrumentVoucherEntity> instrumentvouchers = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentVoucherEntity.class)); if (instrumentvouchers.isEmpty()) return null; else return instrumentvouchers.get(0); }
InstrumentVoucherJdbcRepository extends JdbcRepository { public InstrumentVoucherEntity findById(InstrumentVoucherEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); List<InstrumentVoucherEntity> instrumentvouchers = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentVoucherEntity.class)); if (instrumentvouchers.isEmpty()) return null; else return instrumentvouchers.get(0); } }
InstrumentVoucherJdbcRepository extends JdbcRepository { public InstrumentVoucherEntity findById(InstrumentVoucherEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); List<InstrumentVoucherEntity> instrumentvouchers = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentVoucherEntity.class)); if (instrumentvouchers.isEmpty()) return null; else return instrumentvouchers.get(0); } InstrumentVoucherJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
InstrumentVoucherJdbcRepository extends JdbcRepository { public InstrumentVoucherEntity findById(InstrumentVoucherEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); List<InstrumentVoucherEntity> instrumentvouchers = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentVoucherEntity.class)); if (instrumentvouchers.isEmpty()) return null; else return instrumentvouchers.get(0); } InstrumentVoucherJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); @Override void delete(final String tenantId, final String instrumentId); InstrumentVoucherEntity create(InstrumentVoucherEntity entity); InstrumentVoucherEntity update(InstrumentVoucherEntity entity); Pagination<InstrumentVoucher> search(InstrumentVoucherSearch domain); InstrumentVoucherEntity findById(InstrumentVoucherEntity entity); }
InstrumentVoucherJdbcRepository extends JdbcRepository { public InstrumentVoucherEntity findById(InstrumentVoucherEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); List<InstrumentVoucherEntity> instrumentvouchers = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentVoucherEntity.class)); if (instrumentvouchers.isEmpty()) return null; else return instrumentvouchers.get(0); } InstrumentVoucherJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); @Override void delete(final String tenantId, final String instrumentId); InstrumentVoucherEntity create(InstrumentVoucherEntity entity); InstrumentVoucherEntity update(InstrumentVoucherEntity entity); Pagination<InstrumentVoucher> search(InstrumentVoucherSearch domain); InstrumentVoucherEntity findById(InstrumentVoucherEntity entity);  }