What is JPA?
Learn how Spring JPA makes database operations easy in Java programming.
We'll cover the following
In the previous section on Spring JDBC, we demonstrated how to perform CRUD operations using the JdbcTemplate
class. JDBC requires the developer to write the queries, map values to the query, pass a set of parameters to execute the query, and map rows of the result set to a bean. For simple queries, this task is manageable, but in large applications with hundreds of tables, the queries become complex. Writing and maintaining those queries requires expertise beyond the skillset of a Java developer. Java Persistence API (JPA) is designed to ease that task.
How JPA works
JPA challenges the notion of writing queries and mapping the data back. It creates entities that are Java objects which map to a row in a database table. JPA creates a schema based on the entities and defines relationships between entities. The Object-Relational Mapping (ORM) layer maps the objects to a database table.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy