編程語言 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();

發表評論

腾讯彩票兑奖