Difference between JTA, JPA and Plain JDBC in hibernate

Aashutosh picture Aashutosh · Oct 11, 2010 · Viewed 40.3k times · Source

What is the difference between JTA, JPA and Plain JDBC in terms of Hibernate?

Answer

Bozho picture Bozho · Oct 11, 2010

In order for a difference to exist, there should be something in common, and apart from being database-related (although JTA is not only that), they have nothing more in common:

  • JPA is a standard for Java object-relational mapping - it specifies a set of annotations and an interface -EntityManager to perform persistence operations with the mapped objects. Hibernate implements the JPA standard

  • plain JDBC is a technology for accessing databases. It is what Hibernate actually uses to perform the database operations, "under the hood". It uses JDBC to send queries to the database.

  • JTA is a transaction API, and it is optional in Hibernate. It handles (logically) the transaction behaviour.