I am using Spring Hibernate integration in my application and DAO classes are extending HibernateDaoSupport.
Suppose I save some object using the code getHibernateTemplate().save(object)
Using hibernate template I don’t need to explicitly commit the transaction. I want to know at what point data is committed.
Consider the below code snippet
public void saveObject(){
.......
getHibernateTemplate().save(object1);
....
....
getHibernateTemplate().save(object2);
}
In the above code, exactly at what point object1 will be inserted into the DB..after getHibernateTemplate().save(object1); or at the end of method?
It depends on the transaction manager configuration and/or flush mode settings.
http://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/FlushMode.html