views:

37

answers:

1

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?

+2  A: 

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.

Hans Westerbeek
What else could I have in ORM field?
Feras
It's listed in section 13.1: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/orm.html
Hans Westerbeek