[go: up one dir, main page]

0% found this document useful (0 votes)
5 views17 pages

m5 java

The Java Persistence API (JPA) is a specification that facilitates the management of relational data in Java applications through Object Relational Mapping (ORM). Key components include entities, EntityManager, and Persistence Context, which help in mapping Java objects to database tables and managing database operations. JPA simplifies database interactions and reduces boilerplate code by providing a rich API for developers.

Uploaded by

upadhyaydev29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views17 pages

m5 java

The Java Persistence API (JPA) is a specification that facilitates the management of relational data in Java applications through Object Relational Mapping (ORM). Key components include entities, EntityManager, and Persistence Context, which help in mapping Java objects to database tables and managing database operations. JPA simplifies database interactions and reduces boilerplate code by providing a rich API for developers.

Uploaded by

upadhyaydev29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

MODULE - 5

JPA - Introduction
JPA can be defined as Java Persistence API. It is the Java specification that can provide a
standardized way to manage the relational data in Java applications. JPA facilitates the
management of the database operations and mapping of the Java objects to database
tables by defining the concepts and APIs. It serves as the bridge between the object-
oriented domain models and relational database systems.
JPA (Java Persistence API)
The Java Persistence API (JPA) is the Java API specification that bridges the gap
between relational databases and object-oriented programming by handling the
mapping of the Java objects to the database tables and vice-versa. This process is
known as the Object Relational Mapping (ORM). JPA can define the way Java
classes (entities) are mapped to the database tables and how they can interact
with the database through the EntityManager, the Persistence context, and
transactions.
Key Terminologies in JPA
•Entity

•EntityManager

•Persistence Context

•Criteria API

•JPQL (Java Persistence Query Language)

•Persistence Unit
Entity
An entity is the lightweight and persistent domain object. It represents the table in the database and each entity
instance corresponds to the row in that table.
•Importance: Entities are the core components in the JPA as they can define the structure of the data in JPA
application.

EntityManager

The EntityManager is an interface that can be used to interact with the persistence context. It provides the
operations to create, read, update and delete entities of the JPA application.
•Importance: EntityManager can be essential for all the database interactions in the JPA managed application. It
acts as the factory for the querying and provides the transaction management of JPA application.

Conclusion
JPA is the powerful specification that can simplifies the interaction between the Java
applications and relational databases. By the abstracting database interactions and it can
providing the rich API for the handling of their applications while reducing the boilerplate
code associated with the database operations.
Architecture of JPA

JPA has 6 layers in its class-level


architecture:
1.Entity
2.Persistence Unit
3.EntityManager
4.EntityManagerFactory
5.Query Language
6.Database Layer
Architecture of JPA

You might also like