Difference between JTA, JPA and Plain JDBC in hibernate
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 standardplain 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.
-
JDBC
is a Java standard for database connection. -
JPA
isolates the Java developer from the inner workings of JDBC and database operations. Hibernate, EclipseLink, OpenJPA and Data Nucleus are famous JPA implementations. -
JTA
is a standard for transactions, allowing for management of multiple transactions among multiple databases.
JPA
utilizesJDBC
for database connections and SQL-related operations, and -optionally- utilizesJTA
for delegating distributed transaction management details to it.