Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.torque.om
Interface Persistent

    public interface Persistent

This interface defines methods related to saving an object

Version:
  $Id: Persistent.java 1152582 2011-07-31 13:59:17Z tfischer $
Author:
  John D. McNally, Fedor K.

Method Summary
`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` | `save()` Saves the object.
`void` | `save(Connection con)` Stores the object in the database.
`void` | `save(String dbName)` Stores the object in the database.
`void` | `setModified(boolean m)` Sets the modified state for the object.
`void` | `setNew(boolean b)` Setter for the isNew attribute.
`void` | `setPrimaryKey(ObjectKey primaryKey)` Sets the PrimaryKey for the object.
`void` | `setPrimaryKey(String 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.

### save

    void save()
              throws Exception

  Saves the object.

  Throws:
    `Exception` - This method might throw an exception

### save

    void save(String dbName)
              throws Exception

  Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed.

  Parameters:
    `dbName` - the name of the database
  Throws:
    `Exception` - This method might throw an exception

### save

    void save(Connection con)
              throws Exception

  Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed. This method is meant to be used as part of a transaction, otherwise use the save() method and the connection details will be handled internally

  Parameters:
    `con` - the Connection used to store the object
  Throws:
    `Exception` - This method might throw an exception

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.