You inserted list of column details in to an object it is not a good behaviour,
change it as
public class TestResponse {
private String col1;
private String col2;
// getters and setters
}
use like
List<TestResponse> responses = null;
Use
private static void insertIntoDatabase(List<TestResponse> resps) {
// how to use resp so that I can generate below correct insert SQL query?
// which I can use to execute it?
**// Iterate the above list and update second table**
String query = "INSERT into table-database-B .... ";
}
alter
getFromDatabaseA
like this
List<TestResponse> testResponses = new ArrayList<TestResponse>();
// Iterate for values or execute query for multiple time to get all details from table 1
{
TestResponse testResponse = new TestResponse();
testResponse.setsetCol1(/* ADD COL1 DATA */);
testResponse.setsetCol2(/* ADD COL2 DATA */);
testResponses.add(testResponse);
}
return testResponses;