net.toften.jlips.persist
Interface PersistEntity


public interface PersistEntity

The base interface that all the interfaces specifying the accessor methods should extend This interface provides common methods for all the persist interfaces as well as a number of database related methods.

Version:
$Revision: 1.4 $
Author:
thomas

Method Summary
 void commit()
          Commits all changes made to the object to the database.
 Object get(String fieldName)
          Generic get method This method will return the value any named field in the record.
 Object getPrimaryKey()
          Returns the primary key Note: This method is package scoped, as it should only be used internally in jLips.
 String getTableName()
          Returns the name of the table this entity is related to
 void remove()
          Removes the record from the database Note, that after this method has been called, the reference to the entity should be discarted.
 void rollback()
          The changes made to the data since the last commit will be discarted
 void set(String fieldName, Object value)
          Generic set method This method will set the value of any named field in the record to the specified value
 

Method Detail

getPrimaryKey

Object getPrimaryKey()
Returns the primary key Note: This method is package scoped, as it should only be used internally in jLips. If the application needs access to the primary key, it should provide a get method for the primary key field

Returns:
Object containing the primary key

commit

void commit()
Commits all changes made to the object to the database. When accessor methods are invoked the values supplied are not actually written to the database; they are just held in a temporary store. This is done to minimize the communication to the database. This method forces the temporary data to be written to the database


rollback

void rollback()
The changes made to the data since the last commit will be discarted


remove

void remove()
Removes the record from the database Note, that after this method has been called, the reference to the entity should be discarted. Any attempts to invoke methods on the entity will result in an exception being thrown

See Also:
EntityNotFoundException

get

Object get(String fieldName)
Generic get method This method will return the value any named field in the record.

Parameters:
fieldName - Fieldname to be returned
Returns:
The value of the field

set

void set(String fieldName,
         Object value)
Generic set method This method will set the value of any named field in the record to the specified value

Parameters:
fieldName - Fieldname to be modified
value - New field value

getTableName

String getTableName()
Returns the name of the table this entity is related to

Returns:
Table name of related table