insert方法
public void insert(Object o){
Session session = HibernateSessionFactory.currentSession();
Transaction t = session.beginTransaction();
session.save(o);
t.commit();
HibernateSessionFactory.clossSession();
}
delete方法
public void delete(Object o,Serializable id){
Session session = HibernateSessionFactory.currentSession():
Transaction t = session.beginTransaction();
Object o = session.get(o.class,id);
if(o!=null){
session.delete(o);
文章来源于领测软件测试网 https://www.ltesting.net/