Layman Terms:
JDBC is the standard for database accessJPA is the standard for ORM
JDBC is the standard for connecting directly to the database and executing SQL against it - for example, SELECT * FROM USERS, etc. Datasets can be returned that you can process in your application, and you can do all the usual things like INSERTS, DELETES, run stored procedures, etc. This is one of the main technologies underlying most access to the java database (including JPA providers).
One of the problems with traditional JDBC applications is that you can often have some crappy code where there are many comparisons between datasets and objects, the logic mixes with SQL, etc.
JPA is the standard for relational object mapping. This is a technology that allows you to map objects in code and database tables. This can “hide” SQL from the developer, so all they have to do with them are Java classes, and the provider allows you to save them and load them magically. Basically, XML mapping files or annotations on getters, setters can be used to tell the JPA provider which fields on your feature map are in which fields in the database. The most famous JPA provider is Hibernate, so this is a good place for concrete examples.
http://www.hibernate.org/
Other examples include OpenJPA, toplink, etc.
Under the hood, Hibernate and most other JPA providers write SQL and use JDBC to read and write to the database.
Mark D Aug 09 2018-12-12T00: 00Z
source share