Tuning JPA and Hibernate
Programming with the JDBC API is quite simple as it is merely a thin layer over the database programming interfaces. There are, however, some considerations that you need to take into account:
First, using the native SQL language in your code exposes your application to a tight coupling with the database where your code had initially been developed. Even if the SQL dialects are similar, each database performs differently depending on the structure of the query, necessitating vendor-specific tuning in most cases.
Second, when you are using plain JDBC, you need to bridge the gap between the relational model and the object model by creating a layer of intermediate objects or collections that host the data fetched from the database. This is an unnecessary effort because Object-Relational Mapping (ORM) tools, such as Hibernate, can do it for you out-of-the-box.
Finally, by using an intermediate layer that sits between your code and the database, it's possible to add additional...