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...