Package org.apache.torque.om

## Interface ObjectModel

- All Known Subinterfaces:
    `Persistent`

      public interface ObjectModel

  This interface defines methods related to object referencing and tracking
  Version:
    $Id: Persistent.java 1152582 2011-07-31 13:59:17Z tfischer $
  Author:
    Thomas Vandahl

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ObjectKey<?>` | `getPrimaryKey()` | getter for the object primaryKey.
    `boolean` | `isModified()` | Returns whether the object has been modified, since it was last retrieved from storage.
    `boolean` | `isNew()` | Returns whether the object has ever been saved.
    `void` | `setModified​(boolean m)` | Sets the modified state for the object.
    `void` | `setNew​(boolean b)` | Setter for the isNew attribute.
    `void` | `setPrimaryKey​(String primaryKey)` | Sets the PrimaryKey for the object.
    `void` | `setPrimaryKey​(ObjectKey<?> primaryKey)` | Sets the PrimaryKey for the object.

- - ### Method Detail

    - #### getPrimaryKey

          ObjectKey<?> getPrimaryKey()

      getter for the object primaryKey.
      Returns:
        the object primaryKey as an Object

    - #### setPrimaryKey

          void setPrimaryKey​(ObjectKey<?> primaryKey)
                      throws TorqueException

      Sets the PrimaryKey for the object.
      Parameters:
        `primaryKey` - The new PrimaryKey for the object.
      Throws:
        `TorqueException` - This method might throw an exception

    - #### setPrimaryKey

          void setPrimaryKey​(String primaryKey)
                      throws TorqueException

      Sets the PrimaryKey for the object.
      Parameters:
        `primaryKey` - the String should be of the form produced by ObjectKey.toString().
      Throws:
        `TorqueException` - This method might throw an exception

    - #### isModified

          boolean isModified()

      Returns whether the object has been modified, since it was last retrieved from storage.
      Returns:
        True if the object has been modified.

    - #### isNew

          boolean isNew()

      Returns whether the object has ever been saved. This will be false, if the object was retrieved from storage or was created and then saved.
      Returns:
        true, if the object has never been persisted.

    - #### setNew

          void setNew​(boolean b)

      Setter for the isNew attribute. This method will be called by Torque-generated children and Peers.
      Parameters:
        `b` - the state of the object.

    - #### setModified

          void setModified​(boolean m)

      Sets the modified state for the object.
      Parameters:
        `m` - The new modified state for the object.