我正在尝试构建JSF应用程序,我正在使用hibernate作为ORM解决方案。问题是我的代码充满了复制代码
Transaction tx = null;
Session session = SessionFactoryUtil.getInstance().getCurrentSession();
try {
tx = session.beginTransaction();
tx.commit();}
catch(Exception){}
在每个功能中。春天能帮助我避免这种情况吗?或者它可以添加什么,因为我发现hibernate充满了功能?