@Test @Sql(scripts = { "/sql/budgetreappropriation/clearBudgetReAppropriation.sql", "/sql/budgetreappropriation/insertBudgetReAppropriationData.sql" }) public void test_find_by_invalid_id_should_return_null() { BudgetReAppropriationEntity budgetReAppropriationEntity = BudgetReAppropriationEntity.builder().id("5").build(); budgetReAppropriationEntity.setTenantId("default"); BudgetReAppropriationEntity result = budgetReAppropriationJdbcRepository.findById(budgetReAppropriationEntity); assertNull(result); }
public BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity) { final List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); final Map<String, Object> paramValues = new HashMap<>(); for (final String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); final List<BudgetReAppropriationEntity> budgetreappropriations = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(BudgetReAppropriationEntity.class)); if (budgetreappropriations.isEmpty()) return null; else return budgetreappropriations.get(0); }
BudgetReAppropriationJdbcRepository extends JdbcRepository { public BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity) { final List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); final Map<String, Object> paramValues = new HashMap<>(); for (final String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); final List<BudgetReAppropriationEntity> budgetreappropriations = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(BudgetReAppropriationEntity.class)); if (budgetreappropriations.isEmpty()) return null; else return budgetreappropriations.get(0); } }
BudgetReAppropriationJdbcRepository extends JdbcRepository { public BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity) { final List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); final Map<String, Object> paramValues = new HashMap<>(); for (final String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); final List<BudgetReAppropriationEntity> budgetreappropriations = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(BudgetReAppropriationEntity.class)); if (budgetreappropriations.isEmpty()) return null; else return budgetreappropriations.get(0); } BudgetReAppropriationJdbcRepository(final NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); }
BudgetReAppropriationJdbcRepository extends JdbcRepository { public BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity) { final List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); final Map<String, Object> paramValues = new HashMap<>(); for (final String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); final List<BudgetReAppropriationEntity> budgetreappropriations = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(BudgetReAppropriationEntity.class)); if (budgetreappropriations.isEmpty()) return null; else return budgetreappropriations.get(0); } BudgetReAppropriationJdbcRepository(final NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); BudgetReAppropriationEntity create(final BudgetReAppropriationEntity entity); BudgetReAppropriationEntity update(final BudgetReAppropriationEntity entity); BudgetReAppropriationEntity delete(final BudgetReAppropriationEntity entity); Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain); BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity); }
BudgetReAppropriationJdbcRepository extends JdbcRepository { public BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity) { final List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); final Map<String, Object> paramValues = new HashMap<>(); for (final String s : list) paramValues.put(s, getValue(getField(entity, s), entity)); final List<BudgetReAppropriationEntity> budgetreappropriations = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(BudgetReAppropriationEntity.class)); if (budgetreappropriations.isEmpty()) return null; else return budgetreappropriations.get(0); } BudgetReAppropriationJdbcRepository(final NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); BudgetReAppropriationEntity create(final BudgetReAppropriationEntity entity); BudgetReAppropriationEntity update(final BudgetReAppropriationEntity entity); BudgetReAppropriationEntity delete(final BudgetReAppropriationEntity entity); Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain); BudgetReAppropriationEntity findById(final BudgetReAppropriationEntity entity);  }