3.10.1. Architecture

Internally, OpenJPA does not adhere to any persistence specification. The OpenJPA kernel has its own set of APIs and components. Specifications like JPA and JDO are simply different "personalities" that OpenJPA’s native kernel can adopt.

As an OpenJPA user, you will not normally see beneath OpenJPA’s JPA personality. OpenJPA allows you to access its feature set without leaving the comfort of JPA. Where OpenJPA goes beyond standard JPA functionality, we have crafted JPA-specific APIs to each OpenJPA extension for as seamless an experience as possible.

When writing OpenJPA plugins or otherwise extending the OpenJPA runtime, however, you will use OpenJPA’s native APIs. So that you won’t feel lost, the list below associates each specification interface with its backing native OpenJPA component:

  • jakarta.persistence.EntityManagerFactory: org.apache.openjpa.kernel.BrokerFactory

  • jakarta.persistence.EntityManager: org.apache.openjpa.kernel.Broker

  • jakarta.persistence.Query: org.apache.openjpa.kernel.Query

  • org.apache.openjpa.persistence.Extent: org.apache.openjpa.kernel.Extent

  • org.apache.openjpa.persistence.StoreCache: org.apache.openjpa.datacache.DataCache

  • org.apache.openjpa.persistence.QueryResultCache: org.apache.openjpa.datacache.QueryCache

  • org.apache.openjpa.persistence.FetchPlan: org.apache.openjpa.kernel.FetchConfiguration

  • org.apache.openjpa.persistence.Generator: org.apache.openjpa.kernel.Seq

The org.apache.openjpa.persistence.OpenJPAPersistence helper allows you to convert between EntityManagerFactories and BrokerFactories, EntityManagers and Brokers.