我們一般在用到hibernate寫sql查詢時,有的時候list 中的object並不是已有的model,所以一般我們會重新新建一個model。
方法一:在dao層中編寫。spring框架支援持久層開發
public listgetlist(int rid, string name)if(rs!=null)
if(cs!=null)
}catch (sqlexception e) finally catch (exception e)
if (cs != null)
try catch (exception e)
try
} catch (exception e)
}}
方法二、在dao
public listinfolistbytmember(string sql) catch (exception e) finallyreturn list;
}