@Test @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) public void test_find_by_invalid_id_should_return_null() { InstrumentTypePropertyEntity instrumentTypePropertyEntity = InstrumentTypePropertyEntity.builder().id("5") .build(); instrumentTypePropertyEntity.setTenantId("default"); InstrumentTypePropertyEntity result = instrumentTypePropertyJdbcRepository .findById(instrumentTypePropertyEntity); assertNull(result); }
public InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity 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<InstrumentTypePropertyEntity> instrumenttypeproperties = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class)); if (instrumenttypeproperties.isEmpty()) return null; else return instrumenttypeproperties.get(0); }
InstrumentTypePropertyJdbcRepository extends JdbcRepository { public InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity 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<InstrumentTypePropertyEntity> instrumenttypeproperties = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class)); if (instrumenttypeproperties.isEmpty()) return null; else return instrumenttypeproperties.get(0); } }
InstrumentTypePropertyJdbcRepository extends JdbcRepository { public InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity 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<InstrumentTypePropertyEntity> instrumenttypeproperties = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class)); if (instrumenttypeproperties.isEmpty()) return null; else return instrumenttypeproperties.get(0); } InstrumentTypePropertyJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
InstrumentTypePropertyJdbcRepository extends JdbcRepository { public InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity 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<InstrumentTypePropertyEntity> instrumenttypeproperties = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class)); if (instrumenttypeproperties.isEmpty()) return null; else return instrumenttypeproperties.get(0); } InstrumentTypePropertyJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); InstrumentTypePropertyEntity create(InstrumentTypePropertyEntity entity); InstrumentTypePropertyEntity update(InstrumentTypePropertyEntity entity); InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity entity); }
InstrumentTypePropertyJdbcRepository extends JdbcRepository { public InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity 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<InstrumentTypePropertyEntity> instrumenttypeproperties = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class)); if (instrumenttypeproperties.isEmpty()) return null; else return instrumenttypeproperties.get(0); } InstrumentTypePropertyJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); InstrumentTypePropertyEntity create(InstrumentTypePropertyEntity entity); InstrumentTypePropertyEntity update(InstrumentTypePropertyEntity entity); InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity entity);  }