/** * 调用存储过程(l_p_AssignedMaterial_KanBan) * @return */ public int callProcedure(final String test){ try { Object obj = this.mesJdbcTemplate.execute(new ConnectionCallback() { @Override public Object doInConnection(Connection conn) throws SQLException,DataAccessException { int maxId = 0; conn.setAutoCommit(true); CallableStatement cstmt = conn.prepareCall("{call l_p_AssignedMaterial_KanBan(?)}"); cstmt.setString(1,test); ResultSet resultSet = cstmt.executeQuery(); while(resultSet.next()){ maxId = resultSet.getInt(1); } cstmt.close(); conn.setAutoCommit(false); return maxId; } }); if(obj != null && !obj.toString().trim().equals("")){ return Integer.parseInt(obj.toString()); } } catch (Exception e) { e.printStackTrace(); } return -1; }
利用Hibernate的jdbcTemplate调用存储过程
猜你喜欢
转载自huangshanghua.iteye.com/blog/1611748
今日推荐
周排行