Example & Tutorial understanding programming in easy ways.

Explain about HibernateTemplate?

When we want to access code then we can use the HibernateTemplate is a helper class to used this. With the help this we can get support of automatically converts HibernateExceptions which is checked exception into DataAccessException which is an unchecked exception. 


            HibernateTemplate is typically used to implement data access or business logic services. In this we use the central method is execute(), that has supports the hibernate code that implements HibernateCallback Interface.It provides Hibernate Session handling such that neither the HibernateCallback implementation nor the calling code needs to explicitly care about retrieving/closing Hibernate Sessions, or handling Session lifecycle .


             exceptions.org.springframework.orm.hibernate.HibernateTemplate is that class help to provide the different methods for querying/retrieving data from the database. With the help of this we can also convert checked Hibernateexceptions into unchecked DataAccessExceptions.Uses the same SQLExceptionTranslator mechanism as JdbcTemplate. 

Read More →