开发者

What could spring add to hibernate?

开发者 https://www.devze.com 2023-01-05 16:33 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号