@Test @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", "/sql/instrumenttype/insertInstrumentTypeData.sql" }) public void test_find_by_invalid_id_should_return_null() { InstrumentTypeEntity instrumentTypeEntity = InstrumentTypeEntity.builder().id("5").build(); instrumentTypeEntity.setTenantId("default"); InstrumentTypeEntity result = instrumentTypeJdbcRepository.findById(instrumentTypeEntity); assertNull(result); }
public InstrumentTypeEntity findById(InstrumentTypeEntity 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<InstrumentTypeEntity> instrumenttypes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypeEntity.class)); if (instrumenttypes.isEmpty()) return null; else return instrumenttypes.get(0); }
InstrumentTypeJdbcRepository extends JdbcRepository { public InstrumentTypeEntity findById(InstrumentTypeEntity 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<InstrumentTypeEntity> instrumenttypes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypeEntity.class)); if (instrumenttypes.isEmpty()) return null; else return instrumenttypes.get(0); } }
InstrumentTypeJdbcRepository extends JdbcRepository { public InstrumentTypeEntity findById(InstrumentTypeEntity 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<InstrumentTypeEntity> instrumenttypes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypeEntity.class)); if (instrumenttypes.isEmpty()) return null; else return instrumenttypes.get(0); } InstrumentTypeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); }
InstrumentTypeJdbcRepository extends JdbcRepository { public InstrumentTypeEntity findById(InstrumentTypeEntity 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<InstrumentTypeEntity> instrumenttypes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypeEntity.class)); if (instrumenttypes.isEmpty()) return null; else return instrumenttypes.get(0); } InstrumentTypeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); InstrumentTypeEntity create(InstrumentTypeEntity entity); InstrumentTypeEntity update(InstrumentTypeEntity entity); InstrumentTypeEntity delete(InstrumentTypeEntity entity); Pagination<InstrumentType> search(InstrumentTypeSearch domain); InstrumentTypeEntity findById(InstrumentTypeEntity entity); }
InstrumentTypeJdbcRepository extends JdbcRepository { public InstrumentTypeEntity findById(InstrumentTypeEntity 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<InstrumentTypeEntity> instrumenttypes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypeEntity.class)); if (instrumenttypes.isEmpty()) return null; else return instrumenttypes.get(0); } InstrumentTypeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); InstrumentTypeEntity create(InstrumentTypeEntity entity); InstrumentTypeEntity update(InstrumentTypeEntity entity); InstrumentTypeEntity delete(InstrumentTypeEntity entity); Pagination<InstrumentType> search(InstrumentTypeSearch domain); InstrumentTypeEntity findById(InstrumentTypeEntity entity);  }