开发者

What could spring add to hibernate?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜