【发布时间】:2010-01-04 09:24:05
【问题描述】:
我有企业项目,但所有查询都是使用 oracle 存储过程实现的,我使用 jbdc 和 Spring 框架得到这样的结果:
public class HoaDonDAOimpl extends JdbcDaoSupport implements HoaDonDAO {
public List<HoaDon> getDsTatcaHoadonPhathanh(int vthang, int vnam,
String vmaDvqltb) throws Exception {
CallableStatement cs = getDataSource().getConnection().prepareCall(
"{call PKG_QLNO.GetDsTatcaHoadonPhathanh(?,?,?,?)}");
cs.setInt(1, vthang);
cs.setInt(2, vnam);
cs.setString(3, vmaDvqltb);
cs.registerOutParameter(4, OracleTypes.CURSOR);
cs.execute();
ResultSet rs = (ResultSet) cs.getObject(4);
List<HoaDon> list = new ArrayList<HoaDon>();
while (rs.next()) {
HoaDon hoadon = new HoaDon();
hoadon.setChon(rs.getString("chon"));
hoadon.setMa_so(rs.getString("ma_so"));
hoadon.setMa_kh(rs.getString("ma_kh"));
hoadon.setNam(rs.getString("nam"));
hoadon.setThang(rs.getString("thang"));
hoadon.setTien_PS(rs.getString("tien_PS"));
hoadon.setThue_ps(rs.getString("thue_ps"));
hoadon.setTien_khmai(rs.getString("tien_khmai"));
hoadon.setTien_tbi(rs.getString("tien_tbi"));
hoadon.setTong_ps(rs.getString("tong_ps"));
hoadon.setTenkh(rs.getString("tenkh"));
hoadon.setMa_dvqltb(rs.getString("ma_dvqltb"));
hoadon.setSo_hd_in(rs.getString("so_hd_in"));
hoadon.setNgay_in(rs.getString("ngay_in"));
hoadon.setMa_httt(rs.getString("ma_pttt"));
hoadon.setMa_httt(rs.getString("ma_httt"));
hoadon.setDchi_khang(rs.getString("dchi_khang"));
hoadon.setLoaitb(rs.getString("loaitb"));
hoadon.setKh_hd(rs.getString("kh_hd"));
hoadon.setLoai_hoadon(rs.getString("loai_hoadon"));
hoadon.setLoaihd(rs.getString("loaihd"));
hoadon.setKieu_in(rs.getString("kieu_in"));
list.add(hoadon);
}
return list;
}
但是,问题是,我提交或刷新以再次获取数据大约 4 到 5 次,我的程序没有运行。所以,我该怎么办,请给我一些解决方案,谢谢。
【问题讨论】:
-
如果抛出异常,您能否添加一些控制台输出或跟踪跟踪?
-
我的项目没有任何异常。
-
“不运行”到底是什么意思?
-
第一次和第二次,当我运行我的项目时,它运行正常,但下一次,它让我永远等待,没有任何反应。