sql实时提交事务
1 public void deleteByHbtlidAndDept(String class_id,String depart_id) { 2 Session session = this.getHibernateTemplate().getSessionFactory().openSession(); 3 Transaction tran = session.beginTransaction(); 4 String sql = " delete DC_EQP_DPT_DEF m where m.class_id = '"+class_id+"' and m.depart_id = '"+depart_id+"' "; 5 session.createSQLQuery(sql).executeUpdate(); 6 tran.commit(); 7 }
1 public NaviInfo saveNaviInfo(NaviInfo naviInfo) { 2 Session session = hibernateTemplate.getSessionFactory().openSession(); 3 Transaction tran = session.beginTransaction(); 4 NaviInfo backEntity =(NaviInfo)session.merge(naviInfo); 5 tran.commit(); 6 return backEntity; 7 }