编程语言 php java

hibernate调用存储过程多种方法

java HTML我帮您 1年前  0次浏览

Session session =HibernateSessionFactory.getSession();
Connection conn = session.connection();
ResultSet rs =null;
CallableStatement call = conn.prepareCall("{Call proc()}");
rs = call.executeQuery();
rs.close();
session.close();


Session session =HibernateSessionFactory.getSession();
SQLQuery query = session.createSQLQuery("{Call proc()}");
List list =query.list();
session.close();



CallableStatement call = conn.prepareCall("{Call proc(?)}");
call.setString(1, 参数);
rs = call.executeQuery();




SQLQuery query = session.createSQLQuery("{Call proc(?)}");
query.setString(0, 参数);
List list =query.list();

发表评论