@Test @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", "/sql/surrenderreason/insertSurrenderReasonData.sql" }) public void test_find_by_invalid_id_should_return_null() { SurrenderReasonEntity surrenderReasonEntity = SurrenderReasonEntity.builder().id("5").build(); surrenderReasonEntity.setTenantId("default"); SurrenderReasonEntity result = surrenderReasonJdbcRepository.findById(surrenderReasonEntity); assertNull(result); }
public SurrenderReasonEntity findById(SurrenderReasonEntity 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<SurrenderReasonEntity> surrenderreasons = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(SurrenderReasonEntity.class)); if (surrenderreasons.isEmpty()) return null; else return surrenderreasons.get(0); }
SurrenderReasonJdbcRepository extends JdbcRepository { public SurrenderReasonEntity findById(SurrenderReasonEntity 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<SurrenderReasonEntity> surrenderreasons = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(SurrenderReasonEntity.class)); if (surrenderreasons.isEmpty()) return null; else return surrenderreasons.get(0); } }
SurrenderReasonJdbcRepository extends JdbcRepository { public SurrenderReasonEntity findById(SurrenderReasonEntity 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<SurrenderReasonEntity> surrenderreasons = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(SurrenderReasonEntity.class)); if (surrenderreasons.isEmpty()) return null; else return surrenderreasons.get(0); } SurrenderReasonJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); }
SurrenderReasonJdbcRepository extends JdbcRepository { public SurrenderReasonEntity findById(SurrenderReasonEntity 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<SurrenderReasonEntity> surrenderreasons = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(SurrenderReasonEntity.class)); if (surrenderreasons.isEmpty()) return null; else return surrenderreasons.get(0); } SurrenderReasonJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); SurrenderReasonEntity create(SurrenderReasonEntity entity); SurrenderReasonEntity update(SurrenderReasonEntity entity); SurrenderReasonEntity delete(SurrenderReasonEntity entity); Pagination<SurrenderReason> search(SurrenderReasonSearch domain); SurrenderReasonEntity findById(SurrenderReasonEntity entity); }
SurrenderReasonJdbcRepository extends JdbcRepository { public SurrenderReasonEntity findById(SurrenderReasonEntity 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<SurrenderReasonEntity> surrenderreasons = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(SurrenderReasonEntity.class)); if (surrenderreasons.isEmpty()) return null; else return surrenderreasons.get(0); } SurrenderReasonJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); SurrenderReasonEntity create(SurrenderReasonEntity entity); SurrenderReasonEntity update(SurrenderReasonEntity entity); SurrenderReasonEntity delete(SurrenderReasonEntity entity); Pagination<SurrenderReason> search(SurrenderReasonSearch domain); SurrenderReasonEntity findById(SurrenderReasonEntity entity);  }