java - What is the difference between getHibernateTemplate().flush() and getSession().flush() -


I am using Hibernate 3.2.6. And I'm facing an exception

Save the transient example before flushing

In my code we can never get rid of getSession () Are using. / Code> and some time we get getHibernateTemplate (). Flush () are using in a transaction

Can you please tell me what is the difference between them?

From the days before the transition into annotations as the preferred method for spring transfer management, Spring The code was deprecated. It is not a part of the hibernate. Template code separates mechanisms for creating, collecting and rolling transactions, allowing developers to focus solely on their business logic. Hibernatematelet is no longer considered necessary by the spring community, and has been completely removed in support of spring for Hibernate 4.

From the official document:

Note: Hibernate 3.0.1, Transactional Hibernate Access Code can be coded in plain hibernate style. Therefore, for newly started projects, consider adopting standard Hibernate 3 style of coding data access objects based on SessionFactory.getCurrentSession ().

The approach between developers during mixed code inheritance and mixed transition


Comments