|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.objectledge.database.persistence.DefaultPersistence
public class DefaultPersistence
Provides Object-Relational DB mapping.
| Field Summary | |
|---|---|
private Database |
database
The Database. |
private org.jcontainer.dna.Logger |
logger
The logger |
| Constructor Summary | |
|---|---|
DefaultPersistence(Database database,
org.jcontainer.dna.Logger logger)
Component constructor. |
|
| Method Summary | |
|---|---|
int |
count(String table,
String where)
An utility method for checking the number of matching rows. |
void |
delete(Persistent object)
Removes an object from the database. |
void |
delete(String where,
PersistentFactory factory)
Removes the objects from the database. |
boolean |
exists(String table,
String where)
An utility method for checking for existence of rows. |
Database |
getDatabase()
Get the database component used by persistence. |
Persistent |
load(long id,
PersistentFactory factory)
Loads an object from the database. |
List |
load(String where,
PersistentFactory factory)
Loads objects from the database. |
void |
revert(Persistent object)
Reverts the object to the saved state. |
void |
save(Persistent object)
Saves an object in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Database database
private org.jcontainer.dna.Logger logger
| Constructor Detail |
|---|
public DefaultPersistence(Database database,
org.jcontainer.dna.Logger logger)
database - the database.logger - the logger.| Method Detail |
|---|
public Persistent load(long id,
PersistentFactory factory)
throws PersistenceException
load in interface Persistenceid - the identifier of the object.factory - the object instance factory.
PersistenceException - if any exception occured.
public List load(String where,
PersistentFactory factory)
throws PersistenceException
Note that joins are not supported. This package provides a means of converting objects to rows in a table and vice versa. If you want more, you need some different tool.
load in interface Persistencewhere - the where clause to be used in the queryfactory - the object instance factory.
PersistenceException - if any exception occured.
public void save(Persistent object)
throws PersistenceException
save in interface Persistenceobject - the object to be saved.
PersistenceException - if any exception occured.
public void revert(Persistent object)
throws PersistenceException,
IllegalStateException
revert in interface Persistenceobject - the object to have it's state restored.
PersistenceException - if any exception occured.
IllegalStateException - if no state has been saved yet for the
object in question.
public void delete(Persistent object)
throws PersistenceException
delete in interface Persistenceobject - the object to be removed.
PersistenceException - if any exception occured.
public void delete(String where,
PersistentFactory factory)
throws PersistenceException
delete in interface Persistencewhere - the where clause to be used in the queryfactory - the object instance factory.
PersistenceException - if any exception occured.
public boolean exists(String table,
String where)
throws PersistenceException
exists in interface Persistencetable - the table to be checked.where - the condition.
true if the condition is true for one
or more rows in the table.
PersistenceException - if any exception occured.
public int count(String table,
String where)
throws PersistenceException
count in interface Persistencetable - the table to be chcked.where - the condition.
table matching the condition.
PersistenceException - if any exception occured.public Database getDatabase()
getDatabase in interface Persistence
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||