代码模板-1
Session session = HibernateSessionFactory.getSession();Transaction transaction=null;try {transaction = session.beginTransaction();transaction.begin();//操作transaction.commit();} catch (Exception e) {//日志if(transaction!=null){transaction.rollback();}throw e;}finally{session.close();}?