Class VersionMetaData

java.lang.Object
org.datanucleus.metadata.MetaData
org.datanucleus.metadata.VersionMetaData
All Implemented Interfaces:
Serializable

public class VersionMetaData extends MetaData
Three common strategies for versioning instances are supported by standard metadata.
  • State-comparison involves comparing the values in specific columns to determine if the database row was changed.
  • Timestamp involves comparing the value in a date-time column in the table. The first time in a transaction the row is updated, the timestamp value is updated to the current time.
  • Version-number involves comparing the value in a numeric column in the table. The first time in a transaction the row is updated, the version-number column value is incremented.

There are two forms of version storage.

  • Surrogate column - the default in JDO, using the column/columns/index info in this class
  • Defined member - the default in JPA. This uses the "memberName" info only
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • versionStrategy

      protected VersionStrategy versionStrategy
      strategy for generating the version.
    • columnName

      protected String columnName
      column name
    • columnMetaData

      protected ColumnMetaData columnMetaData
      Contains the metadata for column.
    • indexMetaData

      protected IndexMetaData indexMetaData
      Detail of any indexing of the version column (optional).
    • indexed

      protected IndexedValue indexed
      Indexed value.
    • memberName

      protected String memberName
      Name of the member that contains the version (if not generating a surrogate column).
  • Constructor Details

    • VersionMetaData

      public VersionMetaData()
  • Method Details

    • initialise

      public void initialise(ClassLoaderResolver clr)
      Initialisation method. This should be called AFTER using the populate method if you are going to use populate. It creates the internal convenience arrays etc needed for normal operation.
      Overrides:
      initialise in class MetaData
    • getColumnMetaData

      public final ColumnMetaData getColumnMetaData()
    • setColumnMetaData

      public void setColumnMetaData(ColumnMetaData columnMetaData)
      Mutator for column MetaData.
      Parameters:
      columnMetaData - The column MetaData to set.
    • newColumnMetaData

      public ColumnMetaData newColumnMetaData()
      Method to create a new ColumnMetaData, add it, and return it.
      Returns:
      The Column metadata
    • getStrategy

      public final VersionStrategy getStrategy()
    • setStrategy

      public VersionMetaData setStrategy(VersionStrategy strategy)
    • setStrategy

      public VersionMetaData setStrategy(String strategy)
    • getIndexMetaData

      public final IndexMetaData getIndexMetaData()
    • setIndexMetaData

      public final void setIndexMetaData(IndexMetaData indexMetaData)
    • newIndexMetaData

      public IndexMetaData newIndexMetaData()
      Method to create a new Index metadata, add it, and return it.
      Returns:
      The Index metadata
    • getColumnName

      public String getColumnName()
    • setColumnName

      public VersionMetaData setColumnName(String columnName)
    • getIndexed

      public IndexedValue getIndexed()
    • setIndexed

      public VersionMetaData setIndexed(IndexedValue indexed)
    • getMemberName

      public final String getMemberName()
    • setMemberName

      public VersionMetaData setMemberName(String memberName)
    • toString

      public String toString()
      Overrides:
      toString in class Object