|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.persistence.OpenJPAPersistence
public class OpenJPAPersistence
Static helper methods for JPA users.
Field Summary | |
---|---|
static String |
EM_KEY
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static String |
EMF_KEY
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
Constructor Summary | |
---|---|
OpenJPAPersistence()
|
Method Summary | |
---|---|
static OpenJPAEntityManager |
cast(EntityManager em)
Return the OpenJPA facade to the given entity manager. |
static OpenJPAEntityManagerFactory |
cast(EntityManagerFactory emf)
Return the OpenJPA facade to the given entity manager factory. |
static OpenJPAQuery |
cast(Query q)
Return the OpenJPA facade to the given query. |
static void |
close(Object o)
Close the given resource. |
static OpenJPAEntityManagerFactory |
createEntityManagerFactory(String jndiLocation,
Context context)
Returns the EntityManagerFactory at the JNDI location specified
by jndiLocation in the context context . |
static OpenJPAEntityManagerFactory |
createEntityManagerFactory(String name,
String resource)
Returns a new OpenJPAEntityManagerFactory specified by
name in an XML configuration file at the resource location
resource . |
static OpenJPAEntityManagerFactory |
createEntityManagerFactory(String name,
String resource,
Map map)
Returns a new OpenJPAEntityManagerFactory specified by
name in an XML configuration file at the resource location
resource , applying the properties specified in
map as overrides. |
static Object |
fromOpenJPAObjectId(Object oid)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static Class |
fromOpenJPAObjectIdClass(Class oidClass)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static OpenJPAEntityManager |
getEntityManager(Object o)
Return the entity manager for the given object, if one can be determined from just the object alone. |
static OpenJPAEntityManagerFactory |
getEntityManagerFactory()
Returns the OpenJPAEntityManagerFactory specified by
your OpenJPA defaults. |
static OpenJPAEntityManagerFactory |
getEntityManagerFactory(Map map)
Returns the OpenJPAEntityManagerFactory specified by
your OpenJPA defaults, using map as overrides. |
static ClassMetaData |
getMetaData(EntityManager em,
Class cls)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static ClassMetaData |
getMetaData(EntityManagerFactory factory,
Class cls)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static ClassMetaData |
getMetaData(Object o)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static boolean |
isManagedType(EntityManager em,
Class cls)
Returns true if the specified class is an entity or embeddable type. |
static Broker |
toBroker(EntityManager em)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static BrokerFactory |
toBrokerFactory(EntityManagerFactory factory)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static OpenJPAEntityManager |
toEntityManager(Broker broker)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static OpenJPAEntityManagerFactory |
toEntityManagerFactory(BrokerFactory factory)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static Object |
toOpenJPAObjectId(ClassMetaData meta,
Object oid)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static Collection |
toOpenJPAObjectIds(ClassMetaData meta,
Collection oids)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
static Object[] |
toOpenJPAObjectIds(ClassMetaData meta,
Object... oids)
Deprecated. use JPAFacadeHelper instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String EM_KEY
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.public static final String EMF_KEY
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.Constructor Detail |
---|
public OpenJPAPersistence()
Method Detail |
---|
public static OpenJPAEntityManagerFactory cast(EntityManagerFactory emf)
public static OpenJPAEntityManager cast(EntityManager em)
public static OpenJPAQuery cast(Query q)
public static OpenJPAEntityManagerFactory getEntityManagerFactory()
OpenJPAEntityManagerFactory
specified by
your OpenJPA defaults. This method will return the same logical factory
for each invocation.
public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map)
OpenJPAEntityManagerFactory
specified by
your OpenJPA defaults, using map
as overrides. This method
will return the same logical factory for invocations with the same
overrides.
public static OpenJPAEntityManagerFactory createEntityManagerFactory(String name, String resource)
OpenJPAEntityManagerFactory
specified by
name
in an XML configuration file at the resource location
resource
. If name
is null
, 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. If resource
is null
,
uses the spec-defined META-INF/persistence.xml
resource.
This method only resolves OpenJPAEntityManagerFactory
instances.
public static OpenJPAEntityManagerFactory createEntityManagerFactory(String name, String resource, Map map)
OpenJPAEntityManagerFactory
specified by
name
in an XML configuration file at the resource location
resource
, applying the properties specified in
map
as overrides. If name
is
null
, 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.
If resource
is null
, uses the spec-defined
META-INF/persistence.xml
resource.
This method only resolves OpenJPAEntityManagerFactory
instances.
public static OpenJPAEntityManagerFactory createEntityManagerFactory(String jndiLocation, Context context)
EntityManagerFactory
at the JNDI location specified
by jndiLocation
in the context context
. If
context
is null
,
new InitialContext()
will be used.
public static OpenJPAEntityManager getEntityManager(Object o)
new
), or that were created through
OpenJPAEntityManager.createInstance(java.lang.Class)
.
public static void close(Object o)
public static boolean isManagedType(EntityManager em, Class cls)
public static OpenJPAEntityManagerFactory toEntityManagerFactory(BrokerFactory factory)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static BrokerFactory toBrokerFactory(EntityManagerFactory factory)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static OpenJPAEntityManager toEntityManager(Broker broker)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static Broker toBroker(EntityManager em)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static ClassMetaData getMetaData(Object o)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static ClassMetaData getMetaData(EntityManager em, Class cls)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static ClassMetaData getMetaData(EntityManagerFactory factory, Class cls)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static Object fromOpenJPAObjectId(Object oid)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static Object toOpenJPAObjectId(ClassMetaData meta, Object oid)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static Object[] toOpenJPAObjectIds(ClassMetaData meta, Object... oids)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static Collection toOpenJPAObjectIds(ClassMetaData meta, Collection oids)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
public static Class fromOpenJPAObjectIdClass(Class oidClass)
JPAFacadeHelper
instead. This method pierces
the published-API boundary, as does the JPAFacadeHelper utilization.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |