Package org.datanucleus.api.jdo
Class DataNucleusHelperJDO
java.lang.Object
org.datanucleus.api.jdo.DataNucleusHelperJDO
Helper class for accessing DataNucleus internals from a JDO environment.
This is a supplement to the JDO API class JDOHelper.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
getClassesWithMetaData
(javax.jdo.PersistenceManagerFactory pmf) Accessor for the names of the classes that have MetaData for this PMF.static org.datanucleus.identity.SingleFieldId
getDataNucleusIdentityForSingleFieldIdentity
(javax.jdo.identity.SingleFieldIdentity sfid) static Object[]
Accessor for the jdoDetachedState field of a detached object.static String[]
getDirtyFields
(Object obj, javax.jdo.PersistenceManager pm) Accessor for the names of the dirty fields of the persistable object.static int[]
getFieldsInFetchPlanForClass
(javax.jdo.PersistenceManager pm, String className) Convenience accessor for the fields of a specified class that are currently in the FetchPlan.static String[]
getLoadedFields
(Object obj, javax.jdo.PersistenceManager pm) Accessor for the names of the loaded fields of the persistable object.static org.datanucleus.metadata.ClassMetaData
getMetaDataForClass
(javax.jdo.PersistenceManagerFactory pmf, Class cls) Accessor for the MetaData for the specified classstatic String
getObjectIdClassForInputIdClass
(String objectIdClass) static JDOQueryCache
getQueryResultCache
(javax.jdo.PersistenceManagerFactory pmf) Convenience accessor for the query results cache.static javax.jdo.identity.SingleFieldIdentity
getSingleFieldIdentityForDataNucleusIdentity
(org.datanucleus.identity.SingleFieldId dnid, Class targetClass) Method to convert a DataNucleus "identity" for a single-field application id type to the JDO provided SingleFieldIdentity type.static Boolean
isFieldDirty
(Object obj, String memberName, javax.jdo.PersistenceManager pm) Accessor for whether the specified member (field/property) of the passed persistable object is dirty.static Boolean
isFieldLoaded
(Object obj, String memberName, javax.jdo.PersistenceManager pm) Accessor for whether the specified member (field/property) of the passed persistable object is loaded.
-
Constructor Details
-
DataNucleusHelperJDO
public DataNucleusHelperJDO()
-
-
Method Details
-
getQueryResultCache
Convenience accessor for the query results cache.- Parameters:
pmf
- The PMF- Returns:
- The Query results cache
-
getFieldsInFetchPlanForClass
Convenience accessor for the fields of a specified class that are currently in the FetchPlan.- Parameters:
pm
- Persistence ManagerclassName
- Name of the class- Returns:
- The fields that are in the FetchPlan
-
getSingleFieldIdentityForDataNucleusIdentity
public static javax.jdo.identity.SingleFieldIdentity getSingleFieldIdentityForDataNucleusIdentity(org.datanucleus.identity.SingleFieldId dnid, Class targetClass) Method to convert a DataNucleus "identity" for a single-field application id type to the JDO provided SingleFieldIdentity type. TODO The targetClass "name" is part of the dnid, so could minimise the input args possibly- Parameters:
dnid
- DataNucleus identitytargetClass
- The target class- Returns:
- The JDO SingleFieldIdentity
-
getDataNucleusIdentityForSingleFieldIdentity
public static org.datanucleus.identity.SingleFieldId getDataNucleusIdentityForSingleFieldIdentity(javax.jdo.identity.SingleFieldIdentity sfid) -
getObjectIdClassForInputIdClass
-
getMetaDataForClass
public static org.datanucleus.metadata.ClassMetaData getMetaDataForClass(javax.jdo.PersistenceManagerFactory pmf, Class cls) Accessor for the MetaData for the specified class- Parameters:
pmf
- PersistenceManager factorycls
- The class- Returns:
- The MetaData for the class
-
getClassesWithMetaData
Accessor for the names of the classes that have MetaData for this PMF.- Parameters:
pmf
- The PMF- Returns:
- The class names
-
getDetachedStateForObject
Accessor for the jdoDetachedState field of a detached object. The returned array is made up of :- 0 - the identity of the object
- 1 - the version of the object (upon detach)
- 2 - loadedFields BitSet
- 3 - dirtyFields BitSet
- Parameters:
obj
- The detached object- Returns:
- The detached state
-
getDirtyFields
Accessor for the names of the dirty fields of the persistable object.- Parameters:
obj
- The persistable objectpm
- The Persistence Manager (only required if the object is detached)- Returns:
- Names of the dirty fields
-
getLoadedFields
Accessor for the names of the loaded fields of the persistable object.- Parameters:
obj
- Persistable objectpm
- The Persistence Manager (only required if the object is detached)- Returns:
- Names of the loaded fields
-
isFieldLoaded
Accessor for whether the specified member (field/property) of the passed persistable object is loaded.- Parameters:
obj
- The persistable objectmemberName
- Name of the field/propertypm
- PersistenceManager (if the object is detached)- Returns:
- Whether the member is loaded
-
isFieldDirty
Accessor for whether the specified member (field/property) of the passed persistable object is dirty.- Parameters:
obj
- The persistable objectmemberName
- Name of the field/propertypm
- PersistenceManager (if the object is detached)- Returns:
- Whether the member is dirty
-