org.apache.torque.om
Interface Persistent

All Known Implementing Classes:
BaseObject

public interface Persistent

This interface defines methods related to saving an object

Version:
$Id: Persistent.java 473821 2006-11-11 22:37:25Z tv $
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(java.sql.Connection con)
          Stores the object in the database.
 void save(java.lang.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(java.lang.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 java.lang.Exception
Sets the PrimaryKey for the object.

Parameters:
primaryKey - The new PrimaryKey for the object.
Throws:
java.lang.Exception - This method might throw an exception

setPrimaryKey

void setPrimaryKey(java.lang.String primaryKey)
                   throws java.lang.Exception
Sets the PrimaryKey for the object.

Parameters:
primaryKey - the String should be of the form produced by ObjectKey.toString().
Throws:
java.lang.Exception - 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 java.lang.Exception
Saves the object.

Throws:
java.lang.Exception - This method might throw an exception

save

void save(java.lang.String dbName)
          throws java.lang.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:
java.lang.Exception - This method might throw an exception

save

void save(java.sql.Connection con)
          throws java.lang.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:
java.lang.Exception - This method might throw an exception


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.