Hi All, I have been wrecking at this issue for two days now, kindly assist , here is my code below . I'm retrieving a query result from my postgressql database using mybatis. The mybatis part works fine . What i want to do is to be able to printout the elements in the query result to the screen. And I keep getting the error
Exception occurred during event dispatching:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.sql.ResultSet
at org.elmis.facility.controllers.facilityproductsset upsessionmapperscalls.selectAllFacility_Approved_P roducts(facilityproductssetupsessionmapperscalls.j ava:38)
@SuppressWarnings("unchecked") public ResultSet selectAllFacility_Approved_Products(){ SqlSession session = sqlSessionFactory.openSession(); try { ResultSet RSapprovedproducts = (ResultSet) session.selectList("getAllFacilityApprovedProducts"); while (RSapprovedproducts.next()) { int factypeId = RSapprovedproducts.getInt("facilitytypeid"); int progprodId = RSapprovedproducts.getInt("programproductid"); int id = RSapprovedproducts.getInt("id"); int progId = RSapprovedproducts.getInt("programid"); int prodId = RSapprovedproducts.getInt("productid"); String pcode = RSapprovedproducts.getString("code"); String pname = RSapprovedproducts.getString("primaryname"); int pbeginbal = RSapprovedproducts.getInt("beginningbalance"); int stock = RSapprovedproducts.getInt("stockinhand"); System.out.println(factypeId + " " + progprodId+" "+id +" "+progId+ " " + prodId+ " "+ pcode+" "+ pname+" "+pbeginbal+" "+stock ); } System.out.println(); System.out.println(); return RSapprovedproducts; }catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { session.close(); } return null; }