dao层中的更新方法
public boolean newsUpdate(News news){
/*Session session = getSession();this.update(news);
return true;
*/
Session session = getSession();
Transaction tx = null;
try{
tx = session.beginTransaction();
session.update(news);
tx.commit();
return true;
}catch(Exception e){
e.printStackTrace();
if(tx!=null) tx.rollback();
return false;
}finally{
if(session!=null)
session.close();
}
}