Java操作存储过程

public void insert(BillMain billMain) {
		List list = billMainDAO.getSession().createSQLQuery("{Call proc()}")
				.list();
		// 如果有参数 {Call proc(?)}
		// query.setString(0, 参数);
		Object[] row = null;
		BillMain billMain2 = null;
		for (int i = 0; i < list.size(); i++) {
			row = (Object[]) list.get(i);
			System.out.println(row[0]);
			billMain2 = new BillMain();
			billMain2.setCustomerAdd(row[0].toString());
			billMain2.setCustomerName(row[1].toString());
			billMain2.setEntryId(row[2].toString());
			billMain2.setOperaTime(Timestamp.valueOf(row[3].toString()));
			billMain2.setOperator(row[4].toString());
			billMain2.setUnit(Integer.parseInt(row[5].toString()));

			billMainDAO.save(billMain);
		}
	}

你可能感兴趣的:(java,存储过程)