I'm trying to build JSF application and I'm using hibernate as ORM solution. The problem is that I got my code full of replicate code
Transaction tx = null;
Session session = SessionFactoryUtil.getInstance().getCurrentSession();
try {
tx = session.beginTransaction();
tx.commit();}
catch(Exception){}
in every function. Can spring help me avoid this? or what it could add as I found hibernate开发者_开发技巧 full of features?
Yes this is exactly one of the things that Spring can do for you.
Check out the chapter on transaction management in the reference manual.
精彩评论