ssh2调用oracle的带返回列表的参数怎么调用?
貌似有3种方法:1.jdbc 2.sqlquery接口 3.这个就不说了
JDBC: public List<JcjFinalView> getDataSource() throws HibernateException, SQLException {
return (List<JcjFinalView>) this.getHibernateTemplate().execute(
new HibernateCallback()
{
public Object doInHibernate(Session session) throws SQLException
{
CallableStatement cs = session.connection().prepareCall("{call jjd_reports.report_pro(?)}");
cs.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
cs.execute();
ResultSet rs = (ResultSet) cs.getObject(1);
return rs;
}
}
);
}
这是jdbc的方法,返回值有问题吗?反正报错的时候说oracle.jdbc.driver.OracleResultSetImpl cannot be cast to java.util.Listlquery接口:
public List<JcjFinalView> getDataSource() throws HibernateException, SQLException {
Session session = this.getSession();
String procName="{call jjd_reports.report_pro(?)}"; SQLQuery query = session.createSQLQuery(procName);
List<JcjFinalView> list =query.list(); return list;
这里返回的列表参数怎么获取?
貌似有3种方法:1.jdbc 2.sqlquery接口 3.这个就不说了
JDBC: public List<JcjFinalView> getDataSource() throws HibernateException, SQLException {
return (List<JcjFinalView>) this.getHibernateTemplate().execute(
new HibernateCallback()
{
public Object doInHibernate(Session session) throws SQLException
{
CallableStatement cs = session.connection().prepareCall("{call jjd_reports.report_pro(?)}");
cs.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
cs.execute();
ResultSet rs = (ResultSet) cs.getObject(1);
return rs;
}
}
);
}
这是jdbc的方法,返回值有问题吗?反正报错的时候说oracle.jdbc.driver.OracleResultSetImpl cannot be cast to java.util.Listlquery接口:
public List<JcjFinalView> getDataSource() throws HibernateException, SQLException {
Session session = this.getSession();
String procName="{call jjd_reports.report_pro(?)}"; SQLQuery query = session.createSQLQuery(procName);
List<JcjFinalView> list =query.list(); return list;
这里返回的列表参数怎么获取?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货