}
t.commit();
HibernateSessionFactory.clossSession();
}
update方法
public void update(Object o,Serializable id){
Session session = HibernateSessionFactory.currentSession();
Transaction t = session.beginTransaction();
session.update(o,id);
t.commit();
HibernateSessionFactory.clossSession();
}
基于HQL的通用select方法
public ArrayList select(String sql){
Session session = HibernateSessionFactory.currentSession();
Query query = createQuery(sql);
List list = query.list();
HibernateSessionFactory.clossSession();
return (ArrayList)list;
}
文章来源于领测软件测试网 https://www.ltesting.net/