----------------------------jdbc调用存储过程的方法---------------------------------------------------
private static Connection connection;
//打开连接数据库
@SuppressWarnings("deprecation")
public static void getComConn() {
Session session = HibernateUtil.getSession();
connection = session.connection();
}
Stirng lsql="{call cp_bill_checkzf_pre @bmguid='',@operguid='')}";//存储过程
getComConn();
prstcomm = connection.prepareStatement(lsql);
rstcomm = prstcomm.executeQuery();//查询的方法(如果是更新就用executeUpdate)
if (rstcomm == null) {
return maps;
}
while (rstcomm.next() && rstcomm.getRow() > 0) {
ResultSetMetaData metadata = rstcomm.getMetaData();
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
for (int i = 1; i <= metadata.getColumnCount(); i++) {
map.put(metadata.getColumnName(i), rstcomm.getString(i));
}
maps.add(map);
}