java:prepareStatement先后执行两次查询出现混乱

public ArrayList<MonmentMsg> getAllMontMsg() throws Exception {
    ArrayList<MonmentMsg> allMontMsg = new ArrayList<MonmentMsg>();
    String sql = "SELECT id,user,time,message,imgSrc FROM monment";
    pstm = conn.prepareStatement(sql);
    ResultSet rs = pstm.executeQuery();
    while (rs.next()) {
        MonmentMsg monmentMsg = new MonmentMsg();
        int montId=rs.getInt(1);
        monmentMsg.setId(montId);
        monmentMsg.setSender(rs.getString(2));
        monmentMsg.setMontTime(rs.getString(3));
        monmentMsg.setMessage(rs.getString(4));
        if (rs.getString(5) != null) {          
        String imgSrc = rs.getString(5);// 将绝对路径修改为相对路径
        String temp[] = imgSrc.split("\\\\");
        // for(String element:temp){
        // System.out.println("长度是:"+temp.length);
        // System.out.println(element);
        // }
        int length = temp.length;
        String newImgSrc = "../" + temp[length - 2] + "/" + temp[length - 1];
        System.out.println("新的imgsrc:" + newImgSrc);
        monmentMsg.setImgSrc(newImgSrc);
        }else {
            monmentMsg.setImgSrc("");
        }

        //获取当前动态的所有回复记录
        String getMontMsgSonSql="select user,message from monmentSon where id=?";
        pstm=conn.prepareStatement(getMontMsgSonSql);
        pstm.setInt(1, montId);

        ResultSet rsSon=pstm.executeQuery();
        ArrayList<MontSon> montSonList=new ArrayList<>();
        while (rsSon.next()) {
            System.out.println("回复的用户id"+rs.getString(1));
            System.out.println("回复的内容"+rs.getString(2));
            MontSon montSon=new MontSon();
            montSon.setUser(rs.getString(1));
            montSon.setMessage(rs.getString(2));
            montSonList.add(montSon);
        }
        monmentMsg.setMontSon(montSonList);
        allMontMsg.add(monmentMsg);
    }
    return allMontMsg;
}

pstm变量两个设置成不一样的我觉得应该,但求采纳。

换一下ojdbc.jar 包,我曾经碰到过类似问题,换jar包解决的,和数据库尽量版本匹配