Hi Experts
Happy to see you again. I am developing a method to call the data from the database according to business rule I cannot change the stored procedure because it given by CUSTOMER. My question is the following code is use to get data from the database
public class CustomerManager {
private DataSource dataSource;
private static final
String SPROC_NAME = "{call FetchMarketInfoData(?,?,?,?,?,?,?,?,?,?)}";
public void setDataSource(DataSource source) {
this.dataSource = source;
}
public List<Customer> GetAll() throws SQLException {
Connection conn = dataSource.getConnection();
PreparedStatement stmt = conn.prepareStatement(SPROC_NAME);
stmt.setString(1, null);
stmt.setDate(2, null);
stmt.setDate(3, null);
stmt.setString(4, null);
stmt.setString(5, null);
stmt.setString(6, null);
stmt.setBoolean(7, false);
stmt.setBoolean(8, false);
stmt.setBoolean(9, false);
stmt.setBoolean(10, false);
boolean hasResult = stmt.execute();
List<Customer> iList = new ArrayList<Customer>();
while (hasResult) {
ResultSet res = stmt.getResultSet();
while (res.next()) {
iList.add(CustomerMapper.mapRow(res));
}
hasResult = stmt.getMoreResults();
}
return iList;
}
}
But all the time hasResult shows “
FALSE” I checked with SP for my
testing purpose I added “
SET NOCOUNT ON” after that I run the code, wonder I got the result as I expected then again I remove the “
SET NOCOUNT ON” from the SP and I try the code, Gosh as usual hasResult shows “FALSE”, What’s the reason for it. Is anybody know the reason for it?