在hibernate 中如何转换JDBC的操作?
//方法如下
public void deleteBatch(int userid) throws Exception{
String hql = "DELETE FROM Stock AS stock WHERE stock.userid=?";
Connection conn = (Connection) session.connection();
PreparedStatement pstmt = conn.prepareStatement(hql);
pstmt.setInt(1, userid);
pstmt.executeUpdate();
pstmt.close();
conn.close();
}
//这是它所报的异常
java.lang.ClassCastException: $Proxy0
at com.icxq.impl.StockDAOImpl.deleteBatch(StockDAOImpl.java:51)
at com.test.Test.main(Test.java:12)