@Test public void testSave() { when(jdbcTemplate.update(any(String.class), Matchers.<Object[]>any())).thenReturn(Integer.valueOf("2")); marryingPersonRepository.save(getMarryingPerson(), "ap.kurool"); }
public void save(MarryingPerson marryingPerson, String tenantId) { System.err.println("ps values ::marryingPerson::::::::"+marryingPerson); System.err.println("ps values ::office address::::::::"+marryingPerson.getOfficeAddress()); jdbcTemplate.update(INSERT_MARRYING_PERSON_QUERY, new PreparedStatementSetter(){ @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setLong(1, marryingPerson.getId()); ps.setString(2, marryingPerson.getName()); ps.setString(3, marryingPerson.getParentName()); ps.setString(4,marryingPerson.getStreet()); ps.setString(5,marryingPerson.getLocality()); ps.setString(6,marryingPerson.getCity()); ps.setLong(7,marryingPerson.getDob()); ps.setString(8,marryingPerson.getStatus().toString()); ps.setString(9,marryingPerson.getAadhaar()); ps.setString(10,marryingPerson.getMobileNo()); ps.setString(11,marryingPerson.getEmail()); ps.setLong(12,marryingPerson.getReligion()); ps.setString(13,marryingPerson.getReligionPractice()); ps.setString(14,marryingPerson.getEducation()); ps.setString(15,marryingPerson.getOccupation()); ps.setString(16,marryingPerson.getHandicapped()); ps.setString(17,marryingPerson.getResidenceAddress()); ps.setString(18,marryingPerson.getPhoto()); ps.setString(19,marryingPerson.getNationality()); ps.setString(20,tenantId); ps.setString(21,marryingPerson.getOfficeAddress()); } }); }
MarryingPersonRepository { public void save(MarryingPerson marryingPerson, String tenantId) { System.err.println("ps values ::marryingPerson::::::::"+marryingPerson); System.err.println("ps values ::office address::::::::"+marryingPerson.getOfficeAddress()); jdbcTemplate.update(INSERT_MARRYING_PERSON_QUERY, new PreparedStatementSetter(){ @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setLong(1, marryingPerson.getId()); ps.setString(2, marryingPerson.getName()); ps.setString(3, marryingPerson.getParentName()); ps.setString(4,marryingPerson.getStreet()); ps.setString(5,marryingPerson.getLocality()); ps.setString(6,marryingPerson.getCity()); ps.setLong(7,marryingPerson.getDob()); ps.setString(8,marryingPerson.getStatus().toString()); ps.setString(9,marryingPerson.getAadhaar()); ps.setString(10,marryingPerson.getMobileNo()); ps.setString(11,marryingPerson.getEmail()); ps.setLong(12,marryingPerson.getReligion()); ps.setString(13,marryingPerson.getReligionPractice()); ps.setString(14,marryingPerson.getEducation()); ps.setString(15,marryingPerson.getOccupation()); ps.setString(16,marryingPerson.getHandicapped()); ps.setString(17,marryingPerson.getResidenceAddress()); ps.setString(18,marryingPerson.getPhoto()); ps.setString(19,marryingPerson.getNationality()); ps.setString(20,tenantId); ps.setString(21,marryingPerson.getOfficeAddress()); } }); } }
MarryingPersonRepository { public void save(MarryingPerson marryingPerson, String tenantId) { System.err.println("ps values ::marryingPerson::::::::"+marryingPerson); System.err.println("ps values ::office address::::::::"+marryingPerson.getOfficeAddress()); jdbcTemplate.update(INSERT_MARRYING_PERSON_QUERY, new PreparedStatementSetter(){ @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setLong(1, marryingPerson.getId()); ps.setString(2, marryingPerson.getName()); ps.setString(3, marryingPerson.getParentName()); ps.setString(4,marryingPerson.getStreet()); ps.setString(5,marryingPerson.getLocality()); ps.setString(6,marryingPerson.getCity()); ps.setLong(7,marryingPerson.getDob()); ps.setString(8,marryingPerson.getStatus().toString()); ps.setString(9,marryingPerson.getAadhaar()); ps.setString(10,marryingPerson.getMobileNo()); ps.setString(11,marryingPerson.getEmail()); ps.setLong(12,marryingPerson.getReligion()); ps.setString(13,marryingPerson.getReligionPractice()); ps.setString(14,marryingPerson.getEducation()); ps.setString(15,marryingPerson.getOccupation()); ps.setString(16,marryingPerson.getHandicapped()); ps.setString(17,marryingPerson.getResidenceAddress()); ps.setString(18,marryingPerson.getPhoto()); ps.setString(19,marryingPerson.getNationality()); ps.setString(20,tenantId); ps.setString(21,marryingPerson.getOfficeAddress()); } }); }  }
MarryingPersonRepository { public void save(MarryingPerson marryingPerson, String tenantId) { System.err.println("ps values ::marryingPerson::::::::"+marryingPerson); System.err.println("ps values ::office address::::::::"+marryingPerson.getOfficeAddress()); jdbcTemplate.update(INSERT_MARRYING_PERSON_QUERY, new PreparedStatementSetter(){ @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setLong(1, marryingPerson.getId()); ps.setString(2, marryingPerson.getName()); ps.setString(3, marryingPerson.getParentName()); ps.setString(4,marryingPerson.getStreet()); ps.setString(5,marryingPerson.getLocality()); ps.setString(6,marryingPerson.getCity()); ps.setLong(7,marryingPerson.getDob()); ps.setString(8,marryingPerson.getStatus().toString()); ps.setString(9,marryingPerson.getAadhaar()); ps.setString(10,marryingPerson.getMobileNo()); ps.setString(11,marryingPerson.getEmail()); ps.setLong(12,marryingPerson.getReligion()); ps.setString(13,marryingPerson.getReligionPractice()); ps.setString(14,marryingPerson.getEducation()); ps.setString(15,marryingPerson.getOccupation()); ps.setString(16,marryingPerson.getHandicapped()); ps.setString(17,marryingPerson.getResidenceAddress()); ps.setString(18,marryingPerson.getPhoto()); ps.setString(19,marryingPerson.getNationality()); ps.setString(20,tenantId); ps.setString(21,marryingPerson.getOfficeAddress()); } }); }  void save(MarryingPerson marryingPerson, String tenantId); void update(MarryingPerson marryingPerson, String tenantId); }
MarryingPersonRepository { public void save(MarryingPerson marryingPerson, String tenantId) { System.err.println("ps values ::marryingPerson::::::::"+marryingPerson); System.err.println("ps values ::office address::::::::"+marryingPerson.getOfficeAddress()); jdbcTemplate.update(INSERT_MARRYING_PERSON_QUERY, new PreparedStatementSetter(){ @Override public void setValues(PreparedStatement ps) throws SQLException { ps.setLong(1, marryingPerson.getId()); ps.setString(2, marryingPerson.getName()); ps.setString(3, marryingPerson.getParentName()); ps.setString(4,marryingPerson.getStreet()); ps.setString(5,marryingPerson.getLocality()); ps.setString(6,marryingPerson.getCity()); ps.setLong(7,marryingPerson.getDob()); ps.setString(8,marryingPerson.getStatus().toString()); ps.setString(9,marryingPerson.getAadhaar()); ps.setString(10,marryingPerson.getMobileNo()); ps.setString(11,marryingPerson.getEmail()); ps.setLong(12,marryingPerson.getReligion()); ps.setString(13,marryingPerson.getReligionPractice()); ps.setString(14,marryingPerson.getEducation()); ps.setString(15,marryingPerson.getOccupation()); ps.setString(16,marryingPerson.getHandicapped()); ps.setString(17,marryingPerson.getResidenceAddress()); ps.setString(18,marryingPerson.getPhoto()); ps.setString(19,marryingPerson.getNationality()); ps.setString(20,tenantId); ps.setString(21,marryingPerson.getOfficeAddress()); } }); }  void save(MarryingPerson marryingPerson, String tenantId); void update(MarryingPerson marryingPerson, String tenantId); static final String INSERT_MARRYING_PERSON_QUERY; static final String UPDATE_MARRYING_PERSON_QUERY; }