Package org.apache.openjpa.persistence
Class JPAFacadeHelper
- java.lang.Object
-
- org.apache.openjpa.persistence.JPAFacadeHelper
-
public class JPAFacadeHelper extends java.lang.Object
Helper class for switching between OpenJPA's JPA facade and the underlying Broker kernel.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description JPAFacadeHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
fromOpenJPAObjectId(java.lang.Object oid)
Translate from a OpenJPA identity object to a Persistence one.static java.lang.Class
fromOpenJPAObjectIdClass(java.lang.Class oidClass)
Translate from a OpenJPA identity class to a native one.static ClassMetaData
getMetaData(jakarta.persistence.EntityManagerFactory emf, java.lang.Class cls)
Returns theClassMetaData
associated with the persistent typecls
.static ClassMetaData
getMetaData(jakarta.persistence.EntityManager em, java.lang.Class cls)
Returns theClassMetaData
associated with the persistent typecls
.static ClassMetaData
getMetaData(java.lang.Object o)
Returns theClassMetaData
associated with the persistent objecto
.static Broker
toBroker(jakarta.persistence.EntityManager em)
Return the underlying broker for the given entity manager facade.static BrokerFactory
toBrokerFactory(jakarta.persistence.EntityManagerFactory emf)
Return the underlying broker factory for the given persistence manager factory facade.static OpenJPAEntityManager
toEntityManager(Broker broker)
Return a persistence manager facade to the given broker retaining previously associated persistence context type.static OpenJPAEntityManagerFactory
toEntityManagerFactory(BrokerFactory factory)
static java.lang.Object
toOpenJPAObjectId(ClassMetaData meta, java.lang.Object oid)
Translate from a Persistence identity object to a OpenJPA one.static java.lang.Object[]
toOpenJPAObjectIds(ClassMetaData meta, java.lang.Object... oids)
Return an array of OpenJPA oids for the given native oid array.static java.util.Collection<java.lang.Object>
toOpenJPAObjectIds(ClassMetaData meta, java.util.Collection<java.lang.Object> oids)
Return a collection of OpenJPA oids for the given native oid collection.
-
-
-
Field Detail
-
EM_KEY
public static final java.lang.String EM_KEY
- See Also:
- Constant Field Values
-
EMF_KEY
public static final java.lang.String EMF_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
toEntityManagerFactory
public static OpenJPAEntityManagerFactory toEntityManagerFactory(BrokerFactory factory)
-
toBrokerFactory
public static BrokerFactory toBrokerFactory(jakarta.persistence.EntityManagerFactory emf)
Return the underlying broker factory for the given persistence manager factory facade.
-
toEntityManager
public static OpenJPAEntityManager toEntityManager(Broker broker)
Return a persistence manager facade to the given broker retaining previously associated persistence context type.
-
toBroker
public static Broker toBroker(jakarta.persistence.EntityManager em)
Return the underlying broker for the given entity manager facade.
-
getMetaData
public static ClassMetaData getMetaData(java.lang.Object o)
Returns theClassMetaData
associated with the persistent objecto
.
-
getMetaData
public static ClassMetaData getMetaData(jakarta.persistence.EntityManager em, java.lang.Class cls)
Returns theClassMetaData
associated with the persistent typecls
.
-
getMetaData
public static ClassMetaData getMetaData(jakarta.persistence.EntityManagerFactory emf, java.lang.Class cls)
Returns theClassMetaData
associated with the persistent typecls
.
-
fromOpenJPAObjectId
public static java.lang.Object fromOpenJPAObjectId(java.lang.Object oid)
Translate from a OpenJPA identity object to a Persistence one.
-
toOpenJPAObjectId
public static java.lang.Object toOpenJPAObjectId(ClassMetaData meta, java.lang.Object oid)
Translate from a Persistence identity object to a OpenJPA one. If the provided oid isn't of the expected type a UserException will be thrown.
-
toOpenJPAObjectIds
public static java.lang.Object[] toOpenJPAObjectIds(ClassMetaData meta, java.lang.Object... oids)
Return an array of OpenJPA oids for the given native oid array.
-
toOpenJPAObjectIds
public static java.util.Collection<java.lang.Object> toOpenJPAObjectIds(ClassMetaData meta, java.util.Collection<java.lang.Object> oids)
Return a collection of OpenJPA oids for the given native oid collection.
-
fromOpenJPAObjectIdClass
public static java.lang.Class fromOpenJPAObjectIdClass(java.lang.Class oidClass)
Translate from a OpenJPA identity class to a native one.
-
-