Architecture of JPA

The following diagram shows the class-level architecture of JPA:

Let's describe the diagram:

  • EntityManagerFactory: A factory class of EntityManager that creates and manages multiple EntityManager instances.
  • EntityManager: This is an interface that manages the persistence operations on objects.
  • Entity: This is a persistence object that is stored as records in the database
  • EntityTransaction: This has a one-to-one relationship with EntityManager. For each EntityManager, operations are maintained by the EntityTransaction class.
  • Query: This is an interface that is implemented by each JPA vendor to obtain relational objects with the criteria.
  • Persistence: This is a class. To obtain an EntityManagerFactory instance, it contains static methods.

 

If you look at the diagram again, you may notice that there is some relation between the classes and interfaces that belong to the javax.presistence package:

  • Between EntityManagerFactory and EntityManager, there is a one-to-many relationship
  • Between EntityManager and EntityTransaction, there is a one-to-one relationship
  • Between EntityManager and Query, there is a one-to-many relationship
  • Between EntityManager and Entity, there is a one-to-many relationship
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.114.85