Judging by the exception information is the result set of the database query is closed, so the next
My code is a Impl method (assumed to be a method) call another Impl method (assuming the B method), I after the execution of the B method, called the method of closing the database connection, the result of a method connected to the database closed;
The workaround is to turn off the database connection method in the B method (ie: Super.close (con, pstmt, NULL, RS);) to delete it!
Here's my code for the error:
/**
* Query for deferred tasks
*/
@Override
Public list<extension> Findplantask (String itemId) {
con = super.getconnection ();
List<extension> plantasklist=new arraylist<extension> ();
Extension Extension=null;
String sql= "Select Yq_yjtzrq,yq_rwbh from Qj_extension where yq_xmbh=?";
try{
Pstmt=con.preparestatement (SQL);
Pstmt.setstring (1, itemId);
Rs=pstmt.executequery ();
while (Rs.next ()) {
Extension=new extension ();
EXTENSION.SETYJTZRQ (rs.getstring ("Yq_yjtzrq"));
Plantask plantask= Selectplantask (rs.getstring ("YQ_RWBH"));
Extension.setplantask (Plantask);
Plantasklist.add (extension);
}
}catch (SQLException e) {
E.printstacktrace ();
}
Super.close (con, pstmt, NULL, RS);
return plantasklist;
}
/**
* Query tasks based on the ID of the deferred plan
* @param pid
* @return
*/
Private Plantask Selectplantask (String pid) {
con = super.getconnection ();
Plantask Plantask=null;
String sql= "Select Plantask_rwbh,plantask_rwzt,plantask_rwjc,plantask_jcms,plantask_rwlb,plantask_rwmc,plantask_ Jhksrq,plantask_jhwcrq from Qj_plantask where plantask_jhbh=? ";
try{
Pstmt=con.preparestatement (SQL);
Pstmt.setstring (1, PID);
Rs=pstmt.executequery ();
while (Rs.next ()) {
Plantask=new Plantask ();
PLANTASK.SETPLANTASKRWBH (rs.getstring ("PLANTASK_RWBH"));
Plantask.setplantaskrwzt (rs.getstring ("Plantask_rwzt"));
PLANTASK.SETPLANTASKRWJC (Rs.getint ("PLANTASK_RWJC"));
Plantask.setplantaskjcms (rs.getstring ("Plantask_jcms"));
PLANTASK.SETPLANTASKRWLB (rs.getstring ("PLANTASK_RWLB"));
PLANTASK.SETPLANTASKRWMC (rs.getstring ("PLANTASK_RWMC"));
PLANTASK.SETPLANTASKJHKSRQ (rs.getstring ("PLANTASK_JHKSRQ"));
PLANTASK.SETPLANTASKJHWCRQ (rs.getstring ("Plantask_jhwcrq"));
}
}catch (SQLException e) {
E.printstacktrace ();
}
Super.close (con, pstmt, NULL, RS);
return plantask;
}
Java.sql.SQLException: Off the Resultset:next