Training - JPA
Last Updated on: August 11, 2021 pm
JPA
Introduction to JPA
JPA stands for JAVA PERSISTENCE API.
JPA is an object relational mapping API that makes it easier to
- Extract data from relational databases and put into objects
- Extract data from objects and put into a relational database
JPA is a standard
There are two commonly used ==implementations==
- JBoss Hibernate
- Eclipse Link
Hierarchy
When writing applications to access databases - use JDBC
Then use an ORM Implementation - Hibernate on the top of JDBC
Then use JPA API that sits on the top of the ORM implementation
JPA Entity and Mapping
Further with JPA
Architecture
The Persistence Unit is the entity class along with the persistence.xml file
The Persistence Context, which is a set of entity instances based upon the persistence unit
The Entity Manager which provides access to a persistence context
Entity Object Lifecycle
Persistence - always related to Database
- New - New entities will be managed if persisted.
- Managed - This is the main state. Any changes made to these managed entities will automatically be saved into database.
- Detached
- Removed
JP-QL
JP-QL stands for Java Persistence Query Language.
1 |
|
Named Queries cached -
1 |
|