Class VersionMetaData

  • All Implemented Interfaces:
    Serializable

    public class VersionMetaData
    extends MetaData
    Three common strategies for versioning instances are supported by standard metadata. These include state-comparison, timestamp, and version-number.
    • 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.

    • The JDO method of adding a surrogate column, using the column/columns/index info in this class
    • The JPA method of using an existing field/method. This uses the "fieldName" info only
    See Also:
    Serialized Form
    • Field Detail

      • 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
        IndexMetaData for the version column. TODO Drop this since it doesn't add to what we already have.
      • fieldName

        protected String fieldName
        Name of the field that contains the version (if not generating a surrogate column).
    • Constructor Detail

      • VersionMetaData

        public VersionMetaData()
    • Method Detail

      • 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
      • 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
      • 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()
      • getFieldName

        public final String getFieldName()