Class DataNucleusHelperJDO

java.lang.Object
org.datanucleus.api.jdo.DataNucleusHelperJDO

public class DataNucleusHelperJDO extends Object
Helper class for accessing DataNucleus internals from a JDO environment. This is a supplement to the JDO API class JDOHelper.
  • Constructor Details

    • DataNucleusHelperJDO

      public DataNucleusHelperJDO()
  • Method Details

    • getQueryResultCache

      public static JDOQueryCache getQueryResultCache(javax.jdo.PersistenceManagerFactory pmf)
      Convenience accessor for the query results cache.
      Parameters:
      pmf - The PMF
      Returns:
      The Query results cache
    • getFieldsInFetchPlanForClass

      public static int[] getFieldsInFetchPlanForClass(javax.jdo.PersistenceManager pm, String className)
      Convenience accessor for the fields of a specified class that are currently in the FetchPlan.
      Parameters:
      pm - Persistence Manager
      className - 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 identity
      targetClass - The target class
      Returns:
      The JDO SingleFieldIdentity
    • getDataNucleusIdentityForSingleFieldIdentity

      public static org.datanucleus.identity.SingleFieldId getDataNucleusIdentityForSingleFieldIdentity(javax.jdo.identity.SingleFieldIdentity sfid)
    • getObjectIdClassForInputIdClass

      public static String getObjectIdClassForInputIdClass(String objectIdClass)
    • 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 factory
      cls - The class
      Returns:
      The MetaData for the class
    • getClassesWithMetaData

      public static String[] getClassesWithMetaData(javax.jdo.PersistenceManagerFactory pmf)
      Accessor for the names of the classes that have MetaData for this PMF.
      Parameters:
      pmf - The PMF
      Returns:
      The class names
    • getDetachedStateForObject

      public static Object[] getDetachedStateForObject(Object obj)
      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

      public static String[] getDirtyFields(Object obj, javax.jdo.PersistenceManager pm)
      Accessor for the names of the dirty fields of the persistable object.
      Parameters:
      obj - The persistable object
      pm - The Persistence Manager (only required if the object is detached)
      Returns:
      Names of the dirty fields
    • getLoadedFields

      public static String[] getLoadedFields(Object obj, javax.jdo.PersistenceManager pm)
      Accessor for the names of the loaded fields of the persistable object.
      Parameters:
      obj - Persistable object
      pm - The Persistence Manager (only required if the object is detached)
      Returns:
      Names of the loaded fields
    • isFieldLoaded

      public 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.
      Parameters:
      obj - The persistable object
      memberName - Name of the field/property
      pm - PersistenceManager (if the object is detached)
      Returns:
      Whether the member is loaded
    • isFieldDirty

      public 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.
      Parameters:
      obj - The persistable object
      memberName - Name of the field/property
      pm - PersistenceManager (if the object is detached)
      Returns:
      Whether the member is dirty