`

代码模板-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();
		}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics