@Test public void test_should_update_bankbranch_for_single_object() { BankBranchContractRequest bankBranchContractRequest = new BankBranchContractRequest(); bankBranchContractRequest.setRequestInfo(getRequestInfo()); bankBranchContractRequest.getRequestInfo().setAction("update"); bankBranchContractRequest.setBankBranch(getBankBranchContract()); bankBranchContractRequest.getBankBranch().setId(1l); BankBranchContractRequest response = bankBranchRepository.update(bankBranchContractRequest); verify(jdbcTemplate).batchUpdate(any(String.class), any(List.class)); assertEquals(Long.valueOf(1), response.getBankBranch().getId()); assertEquals(BRANCHNAME, response.getBankBranch().getName()); assertEquals(BRANCHCODE, response.getBankBranch().getCode()); }
public BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest) { List<Object[]> batchArgs = new ArrayList<>(); if (bankBranchContractRequest.getBankBranches() != null) for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContract.setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContract.setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContract.getBank().getId(), bankBranchContract.getCode(), bankBranchContract.getName(), bankBranchContract.getAddress(), bankBranchContract.getAddress2(), bankBranchContract.getCity(), bankBranchContract.getState(), bankBranchContract.getPincode(), bankBranchContract.getPhone(), bankBranchContract.getFax(), bankBranchContract.getContactPerson(), bankBranchContract.getActive(), bankBranchContract.getDescription(), bankBranchContract.getMicr(), bankBranchContract.getTenantId(), bankBranchContract.getLastModifiedBy(), bankBranchContract.getLastModifiedDate(), bankBranchContract.getId(), bankBranchContract.getTenantId() }; batchArgs.add(lobRecord); } if (bankBranchContractRequest.getBankBranch() != null && bankBranchContractRequest.getBankBranch().getName() != null) { bankBranchContractRequest.getBankBranch() .setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContractRequest.getBankBranch().setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContractRequest.getBankBranch().getBank().getId(), bankBranchContractRequest.getBankBranch().getCode(), bankBranchContractRequest.getBankBranch().getName(), bankBranchContractRequest.getBankBranch().getAddress(), bankBranchContractRequest.getBankBranch().getAddress2(), bankBranchContractRequest.getBankBranch().getCity(), 4, bankBranchContractRequest.getBankBranch().getState(), bankBranchContractRequest.getBankBranch().getPincode(), bankBranchContractRequest.getBankBranch().getPhone(), bankBranchContractRequest.getBankBranch().getFax(), bankBranchContractRequest.getBankBranch().getContactPerson(), bankBranchContractRequest.getBankBranch().getActive(), bankBranchContractRequest.getBankBranch().getDescription(), bankBranchContractRequest.getBankBranch().getMicr(), bankBranchContractRequest.getBankBranch().getTenantId(), bankBranchContractRequest.getBankBranch().getLastModifiedBy(), bankBranchContractRequest.getBankBranch().getLastModifiedDate(), bankBranchContractRequest.getBankBranch().getId(), bankBranchContractRequest.getBankBranch().getTenantId() }; batchArgs.add(lobRecord); } try { jdbcTemplate.batchUpdate(UPDATE_BANKBRANCH_QUERY, batchArgs); } catch (DataAccessException ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } return bankBranchContractRequest; }
BankBranchRepository { public BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest) { List<Object[]> batchArgs = new ArrayList<>(); if (bankBranchContractRequest.getBankBranches() != null) for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContract.setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContract.setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContract.getBank().getId(), bankBranchContract.getCode(), bankBranchContract.getName(), bankBranchContract.getAddress(), bankBranchContract.getAddress2(), bankBranchContract.getCity(), bankBranchContract.getState(), bankBranchContract.getPincode(), bankBranchContract.getPhone(), bankBranchContract.getFax(), bankBranchContract.getContactPerson(), bankBranchContract.getActive(), bankBranchContract.getDescription(), bankBranchContract.getMicr(), bankBranchContract.getTenantId(), bankBranchContract.getLastModifiedBy(), bankBranchContract.getLastModifiedDate(), bankBranchContract.getId(), bankBranchContract.getTenantId() }; batchArgs.add(lobRecord); } if (bankBranchContractRequest.getBankBranch() != null && bankBranchContractRequest.getBankBranch().getName() != null) { bankBranchContractRequest.getBankBranch() .setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContractRequest.getBankBranch().setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContractRequest.getBankBranch().getBank().getId(), bankBranchContractRequest.getBankBranch().getCode(), bankBranchContractRequest.getBankBranch().getName(), bankBranchContractRequest.getBankBranch().getAddress(), bankBranchContractRequest.getBankBranch().getAddress2(), bankBranchContractRequest.getBankBranch().getCity(), 4, bankBranchContractRequest.getBankBranch().getState(), bankBranchContractRequest.getBankBranch().getPincode(), bankBranchContractRequest.getBankBranch().getPhone(), bankBranchContractRequest.getBankBranch().getFax(), bankBranchContractRequest.getBankBranch().getContactPerson(), bankBranchContractRequest.getBankBranch().getActive(), bankBranchContractRequest.getBankBranch().getDescription(), bankBranchContractRequest.getBankBranch().getMicr(), bankBranchContractRequest.getBankBranch().getTenantId(), bankBranchContractRequest.getBankBranch().getLastModifiedBy(), bankBranchContractRequest.getBankBranch().getLastModifiedDate(), bankBranchContractRequest.getBankBranch().getId(), bankBranchContractRequest.getBankBranch().getTenantId() }; batchArgs.add(lobRecord); } try { jdbcTemplate.batchUpdate(UPDATE_BANKBRANCH_QUERY, batchArgs); } catch (DataAccessException ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } return bankBranchContractRequest; } }
BankBranchRepository { public BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest) { List<Object[]> batchArgs = new ArrayList<>(); if (bankBranchContractRequest.getBankBranches() != null) for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContract.setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContract.setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContract.getBank().getId(), bankBranchContract.getCode(), bankBranchContract.getName(), bankBranchContract.getAddress(), bankBranchContract.getAddress2(), bankBranchContract.getCity(), bankBranchContract.getState(), bankBranchContract.getPincode(), bankBranchContract.getPhone(), bankBranchContract.getFax(), bankBranchContract.getContactPerson(), bankBranchContract.getActive(), bankBranchContract.getDescription(), bankBranchContract.getMicr(), bankBranchContract.getTenantId(), bankBranchContract.getLastModifiedBy(), bankBranchContract.getLastModifiedDate(), bankBranchContract.getId(), bankBranchContract.getTenantId() }; batchArgs.add(lobRecord); } if (bankBranchContractRequest.getBankBranch() != null && bankBranchContractRequest.getBankBranch().getName() != null) { bankBranchContractRequest.getBankBranch() .setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContractRequest.getBankBranch().setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContractRequest.getBankBranch().getBank().getId(), bankBranchContractRequest.getBankBranch().getCode(), bankBranchContractRequest.getBankBranch().getName(), bankBranchContractRequest.getBankBranch().getAddress(), bankBranchContractRequest.getBankBranch().getAddress2(), bankBranchContractRequest.getBankBranch().getCity(), 4, bankBranchContractRequest.getBankBranch().getState(), bankBranchContractRequest.getBankBranch().getPincode(), bankBranchContractRequest.getBankBranch().getPhone(), bankBranchContractRequest.getBankBranch().getFax(), bankBranchContractRequest.getBankBranch().getContactPerson(), bankBranchContractRequest.getBankBranch().getActive(), bankBranchContractRequest.getBankBranch().getDescription(), bankBranchContractRequest.getBankBranch().getMicr(), bankBranchContractRequest.getBankBranch().getTenantId(), bankBranchContractRequest.getBankBranch().getLastModifiedBy(), bankBranchContractRequest.getBankBranch().getLastModifiedDate(), bankBranchContractRequest.getBankBranch().getId(), bankBranchContractRequest.getBankBranch().getTenantId() }; batchArgs.add(lobRecord); } try { jdbcTemplate.batchUpdate(UPDATE_BANKBRANCH_QUERY, batchArgs); } catch (DataAccessException ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } return bankBranchContractRequest; } @Autowired  BankBranchRepository(final JdbcTemplate jdbcTemplate, BankBranchRowMapper bankBranchRowMapper,
			BankBranchQueryBuilder bankBranchQueryBuilder); }
BankBranchRepository { public BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest) { List<Object[]> batchArgs = new ArrayList<>(); if (bankBranchContractRequest.getBankBranches() != null) for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContract.setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContract.setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContract.getBank().getId(), bankBranchContract.getCode(), bankBranchContract.getName(), bankBranchContract.getAddress(), bankBranchContract.getAddress2(), bankBranchContract.getCity(), bankBranchContract.getState(), bankBranchContract.getPincode(), bankBranchContract.getPhone(), bankBranchContract.getFax(), bankBranchContract.getContactPerson(), bankBranchContract.getActive(), bankBranchContract.getDescription(), bankBranchContract.getMicr(), bankBranchContract.getTenantId(), bankBranchContract.getLastModifiedBy(), bankBranchContract.getLastModifiedDate(), bankBranchContract.getId(), bankBranchContract.getTenantId() }; batchArgs.add(lobRecord); } if (bankBranchContractRequest.getBankBranch() != null && bankBranchContractRequest.getBankBranch().getName() != null) { bankBranchContractRequest.getBankBranch() .setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContractRequest.getBankBranch().setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContractRequest.getBankBranch().getBank().getId(), bankBranchContractRequest.getBankBranch().getCode(), bankBranchContractRequest.getBankBranch().getName(), bankBranchContractRequest.getBankBranch().getAddress(), bankBranchContractRequest.getBankBranch().getAddress2(), bankBranchContractRequest.getBankBranch().getCity(), 4, bankBranchContractRequest.getBankBranch().getState(), bankBranchContractRequest.getBankBranch().getPincode(), bankBranchContractRequest.getBankBranch().getPhone(), bankBranchContractRequest.getBankBranch().getFax(), bankBranchContractRequest.getBankBranch().getContactPerson(), bankBranchContractRequest.getBankBranch().getActive(), bankBranchContractRequest.getBankBranch().getDescription(), bankBranchContractRequest.getBankBranch().getMicr(), bankBranchContractRequest.getBankBranch().getTenantId(), bankBranchContractRequest.getBankBranch().getLastModifiedBy(), bankBranchContractRequest.getBankBranch().getLastModifiedDate(), bankBranchContractRequest.getBankBranch().getId(), bankBranchContractRequest.getBankBranch().getTenantId() }; batchArgs.add(lobRecord); } try { jdbcTemplate.batchUpdate(UPDATE_BANKBRANCH_QUERY, batchArgs); } catch (DataAccessException ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } return bankBranchContractRequest; } @Autowired  BankBranchRepository(final JdbcTemplate jdbcTemplate, BankBranchRowMapper bankBranchRowMapper,
			BankBranchQueryBuilder bankBranchQueryBuilder); BankBranchContractRequest create(BankBranchContractRequest bankBranchContractRequest); BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest); List<BankBranchContract> findForCriteria(BankBranchGetRequest bankBranchGetRequest); }
BankBranchRepository { public BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest) { List<Object[]> batchArgs = new ArrayList<>(); if (bankBranchContractRequest.getBankBranches() != null) for (BankBranchContract bankBranchContract : bankBranchContractRequest.getBankBranches()) { bankBranchContract.setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContract.setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContract.getBank().getId(), bankBranchContract.getCode(), bankBranchContract.getName(), bankBranchContract.getAddress(), bankBranchContract.getAddress2(), bankBranchContract.getCity(), bankBranchContract.getState(), bankBranchContract.getPincode(), bankBranchContract.getPhone(), bankBranchContract.getFax(), bankBranchContract.getContactPerson(), bankBranchContract.getActive(), bankBranchContract.getDescription(), bankBranchContract.getMicr(), bankBranchContract.getTenantId(), bankBranchContract.getLastModifiedBy(), bankBranchContract.getLastModifiedDate(), bankBranchContract.getId(), bankBranchContract.getTenantId() }; batchArgs.add(lobRecord); } if (bankBranchContractRequest.getBankBranch() != null && bankBranchContractRequest.getBankBranch().getName() != null) { bankBranchContractRequest.getBankBranch() .setLastModifiedBy(bankBranchContractRequest.getRequestInfo().getUserInfo().getId()); bankBranchContractRequest.getBankBranch().setLastModifiedDate(new Date(System.currentTimeMillis())); Object[] lobRecord = { bankBranchContractRequest.getBankBranch().getBank().getId(), bankBranchContractRequest.getBankBranch().getCode(), bankBranchContractRequest.getBankBranch().getName(), bankBranchContractRequest.getBankBranch().getAddress(), bankBranchContractRequest.getBankBranch().getAddress2(), bankBranchContractRequest.getBankBranch().getCity(), 4, bankBranchContractRequest.getBankBranch().getState(), bankBranchContractRequest.getBankBranch().getPincode(), bankBranchContractRequest.getBankBranch().getPhone(), bankBranchContractRequest.getBankBranch().getFax(), bankBranchContractRequest.getBankBranch().getContactPerson(), bankBranchContractRequest.getBankBranch().getActive(), bankBranchContractRequest.getBankBranch().getDescription(), bankBranchContractRequest.getBankBranch().getMicr(), bankBranchContractRequest.getBankBranch().getTenantId(), bankBranchContractRequest.getBankBranch().getLastModifiedBy(), bankBranchContractRequest.getBankBranch().getLastModifiedDate(), bankBranchContractRequest.getBankBranch().getId(), bankBranchContractRequest.getBankBranch().getTenantId() }; batchArgs.add(lobRecord); } try { jdbcTemplate.batchUpdate(UPDATE_BANKBRANCH_QUERY, batchArgs); } catch (DataAccessException ex) { ex.printStackTrace(); throw new RuntimeException(ex.getMessage()); } return bankBranchContractRequest; } @Autowired  BankBranchRepository(final JdbcTemplate jdbcTemplate, BankBranchRowMapper bankBranchRowMapper,
			BankBranchQueryBuilder bankBranchQueryBuilder); BankBranchContractRequest create(BankBranchContractRequest bankBranchContractRequest); BankBranchContractRequest update(BankBranchContractRequest bankBranchContractRequest); List<BankBranchContract> findForCriteria(BankBranchGetRequest bankBranchGetRequest); static final String INSERT_BANKBRANCH_QUERY; static final String UPDATE_BANKBRANCH_QUERY; }