Introduction to Spring Hibernate and Spring Data

As we saw in previous chapters, Java Database Connectivity (JDBC) exposes an API that hides the database vendor-specific communication. However, it suffers from the following limitations:

  • JDBC development is very much verbose, even for trivial tasks
  • JDBC batching requires a specific API and is not transparent
  • JDBC does not provide built-in support for explicit locking and optimistic concurrency control
  • There is a need to handle transactions explicitly, with lots of duplicate code
  • Joined queries require additional processing to transform the ResultSet into domain models, or data transfer objects (DTO)

Almost all limitations of JDBC are covered by ORM frameworks. ORM frameworks provide for object mapping, lazy loading, eager loading, managing resources, cascading, error handling, and other services at the data access layer. One of the ORM frameworks is Hibernate. Spring Data is a layer implemented by the Spring Framework to provide boilerplate code and ease the access to different kinds of persistence stores used in applications. Let's see an overview of Spring Hibernate and Spring Data in the following sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset