I'm new to Hibernate so I need some advice/direction on doing Transactions.
I have a DAO like
public class MyDao extends HibernateDaoSupport implements IMyDao {
@Override
public Foo getFoo(int id) {
return (Foo)getHibernateTemplate().load(Foo.class, id);
}
}
With this setup (using HibernateDaoSupport), will Hibernate/Spring handle transactions for me? Some of the examples I see say yes, others show using
Transaction tx = getHibernateTemplate().getSessionFactory().getCurrentSession().beginTransaction();
to get a Transaction in every DAO method.
Right now I'm assuming my minimal DAO is correct but I want to do a "larger" transaction that includes a couple of Hibernate calls in one method. Would I use the manual Transaction method there? Do I have to use it everywhere? Thanks.