Spring comes with a family of data access frameworks that integrate with a variety of data access technologies. Whether youre persisting your data via direct JDBC, iBATIS, or an object relational mapping (ORM) framework such as Hibernate, Spring removes the tedium of data access from your persistence code. We could use JDBC, Hibernate, the Java Persistence API (JPA), or any of a number of persistence. Spring supports all of those persistence mechanisms.
Hibernate is an open source persistence framework that has gained significant popularity in the developer community. It provides not only basic object-relational mapping but also all the other sophisticated features youd expect from a full-featured ORM tool, such as caching, lazy loading, eager fetching, and distributed caching. This section will cover many issues in detail and show different variations of DAO implementations.
"DAOs exist to provide a means to read and write data to the database. They should expose this functionality through an interface by which the rest of the application will access them."
Declaring a Hibernate session factory
Spring allows you to define resources such as a JDBC DataSource or a Hibernate SessionFactory as beans in the Spring container. Application objects that need to access resources just receive references to such pre-defined instances via bean references.