Package org.apache.openjpa.persistence
Class OpenJPAPersistence
java.lang.Object
org.apache.openjpa.persistence.OpenJPAPersistence
Static helper methods for JPA users.
- Since:
- 0.4.0
- Author:
- Abe White
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.static final StringDeprecated.useJPAFacadeHelperinstead. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenJPAEntityManagercast(jakarta.persistence.EntityManager em) Return the OpenJPA facade to the given entity manager.static OpenJPAEntityManagerFactorycast(jakarta.persistence.EntityManagerFactory emf) Return the OpenJPA facade to the given entity manager factory.static OpenJPAQuerycast(jakarta.persistence.Query q) Return the OpenJPA facade to the given query.static voidClose the given resource.static OpenJPAEntityManagerFactorycreateEntityManagerFactory(String name, String resource) Returns a newOpenJPAEntityManagerFactoryspecified bynamein an XML configuration file at the resource locationresource.static OpenJPAEntityManagerFactorycreateEntityManagerFactory(String name, String resource, Map map) Returns a newOpenJPAEntityManagerFactoryspecified bynamein an XML configuration file at the resource locationresource, applying the properties specified inmapas overrides.static OpenJPAEntityManagerFactorycreateEntityManagerFactory(String jndiLocation, Context context) Returns theEntityManagerFactoryat the JNDI location specified byjndiLocationin the contextcontext.static ObjectDeprecated.useJPAFacadeHelperinstead.static ClassfromOpenJPAObjectIdClass(Class oidClass) Deprecated.useJPAFacadeHelperinstead.static OpenJPAEntityManagerReturn the entity manager for the given object, if one can be determined from just the object alone.static OpenJPAEntityManagerFactoryReturns theOpenJPAEntityManagerFactoryspecified by your OpenJPA defaults.static OpenJPAEntityManagerFactoryReturns theOpenJPAEntityManagerFactoryspecified by your OpenJPA defaults, usingmapas overrides.static ClassMetaDatagetMetaData(jakarta.persistence.EntityManagerFactory factory, Class cls) Deprecated.useJPAFacadeHelperinstead.static ClassMetaDatagetMetaData(jakarta.persistence.EntityManager em, Class cls) Deprecated.useJPAFacadeHelperinstead.static ClassMetaDataDeprecated.useJPAFacadeHelperinstead.static booleanisManagedType(jakarta.persistence.EntityManager em, Class cls) Returns true if the specified class is an entity or embeddable type.static BrokertoBroker(jakarta.persistence.EntityManager em) Deprecated.useJPAFacadeHelperinstead.static BrokerFactorytoBrokerFactory(jakarta.persistence.EntityManagerFactory factory) Deprecated.useJPAFacadeHelperinstead.static OpenJPAEntityManagertoEntityManager(Broker broker) Deprecated.useJPAFacadeHelperinstead.static OpenJPAEntityManagerFactorytoEntityManagerFactory(BrokerFactory factory) Deprecated.useJPAFacadeHelperinstead.static ObjecttoOpenJPAObjectId(ClassMetaData meta, Object oid) Deprecated.useJPAFacadeHelperinstead.static Object[]toOpenJPAObjectIds(ClassMetaData meta, Object... oids) Deprecated.useJPAFacadeHelperinstead.static CollectiontoOpenJPAObjectIds(ClassMetaData meta, Collection oids) Deprecated.useJPAFacadeHelperinstead.
-
Field Details
-
EM_KEY
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization.- See Also:
-
EMF_KEY
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization.- See Also:
-
-
Constructor Details
-
OpenJPAPersistence
public OpenJPAPersistence()
-
-
Method Details
-
cast
Return the OpenJPA facade to the given entity manager factory. -
cast
Return the OpenJPA facade to the given entity manager. -
cast
Return the OpenJPA facade to the given query. -
getEntityManagerFactory
Returns theOpenJPAEntityManagerFactoryspecified by your OpenJPA defaults. This method will return the same logical factory for each invocation. -
getEntityManagerFactory
Returns theOpenJPAEntityManagerFactoryspecified by your OpenJPA defaults, usingmapas overrides. This method will return the same logical factory for invocations with the same overrides. -
createEntityManagerFactory
Returns a newOpenJPAEntityManagerFactoryspecified bynamein an XML configuration file at the resource locationresource. Ifnameisnull, uses the first resource found in the specified location, regardless of the name specified in the XML resource or the name of the jar that the resource is contained in. Ifresourceisnull, uses the spec-definedMETA-INF/persistence.xmlresource. This method only resolvesOpenJPAEntityManagerFactoryinstances. -
createEntityManagerFactory
public static OpenJPAEntityManagerFactory createEntityManagerFactory(String name, String resource, Map map) Returns a newOpenJPAEntityManagerFactoryspecified bynamein an XML configuration file at the resource locationresource, applying the properties specified inmapas overrides. Ifnameisnull, uses the first resource found in the specified location, regardless of the name specified in the XML resource or the name of the jar that the resource is contained in. Ifresourceisnull, uses the spec-definedMETA-INF/persistence.xmlresource. This method only resolvesOpenJPAEntityManagerFactoryinstances. -
createEntityManagerFactory
public static OpenJPAEntityManagerFactory createEntityManagerFactory(String jndiLocation, Context context) Returns theEntityManagerFactoryat the JNDI location specified byjndiLocationin the contextcontext. Ifcontextisnull,new InitialContext()will be used. -
getEntityManager
Return the entity manager for the given object, if one can be determined from just the object alone. This method will succeed for instances that are enhanced, that were loaded from the database (rather than being constructed withnew), or that were created throughOpenJPAEntityManager.createInstance(java.lang.Class<T>). -
close
Close the given resource. The resource can be an extent iterator, query result, large result set relation, or any closeable OpenJPA component. -
isManagedType
Returns true if the specified class is an entity or embeddable type. -
toEntityManagerFactory
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
toBrokerFactory
@Deprecated public static BrokerFactory toBrokerFactory(jakarta.persistence.EntityManagerFactory factory) Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
toEntityManager
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
toBroker
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
getMetaData
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
getMetaData
@Deprecated public static ClassMetaData getMetaData(jakarta.persistence.EntityManager em, Class cls) Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
getMetaData
@Deprecated public static ClassMetaData getMetaData(jakarta.persistence.EntityManagerFactory factory, Class cls) Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
fromOpenJPAObjectId
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
toOpenJPAObjectId
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
toOpenJPAObjectIds
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
toOpenJPAObjectIds
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization. -
fromOpenJPAObjectIdClass
Deprecated.useJPAFacadeHelperinstead. This method pierces the published-API boundary, as does the JPAFacadeHelper utilization.
-
JPAFacadeHelperinstead.