|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.sql.JDBCRowProxy<T>
public class JDBCRowProxy<T extends Resource>
provides JDBC persistence for Objects that have a corresponding ObjectRowMapper. For every access to the database, this implementation requires the database transaction to be active.
ObjectRowMapper| Field Summary | |
|---|---|
protected Database<Connection> |
database
|
protected ConnectionHelper |
helper
|
protected ObjectRowMapper<T> |
mapper
|
| Constructor Summary | |
|---|---|
JDBCRowProxy(Database<Connection> database,
ObjectRowMapper<T> mapper)
|
|
| Method Summary | |
|---|---|
boolean |
contains(T entry)
determines whether the given entry is present in the database; it may be, however, that the database object differs from the given object (but its IDs must be the same) if present. |
void |
delete(T entry)
removes the given entry from the database |
AbstractIterator<T> |
fetch(Filter<T> filter)
if the iteration fails at any point, an IterationException is thrown. |
Object |
generateNewID()
returns a value supplied by the mapper |
Database<Connection> |
getDatabase()
provides access to the database instance that also coordinates the transaction management. |
ObjectRowMapper<T> |
getMapper()
|
T |
getResource(Object id)
returns a Resource based on its ID. |
void |
insert(T entry)
it is suggested to create the entry with an ID obtained through generateNewID() before passing it into
this method. |
int |
size()
returns the total number of T elements in this store |
void |
update(T entry)
updates the given entry in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Database<Connection> database
protected ConnectionHelper helper
protected ObjectRowMapper<T extends Resource> mapper
| Constructor Detail |
|---|
public JDBCRowProxy(Database<Connection> database,
ObjectRowMapper<T> mapper)
| Method Detail |
|---|
public Database<Connection> getDatabase()
DBClassStore
getDatabase in interface DBClassStore<T extends Resource>public ObjectRowMapper<T> getMapper()
public boolean contains(T entry)
throws DatabaseException
DBClassStore
contains in interface DBClassStore<T extends Resource>DatabaseException
public void delete(T entry)
throws DatabaseException
DBClassStore
delete in interface DBClassStore<T extends Resource>DatabaseException
public void insert(T entry)
throws DatabaseException
DBClassStoregenerateNewID() before passing it into
this method.
insert in interface DBClassStore<T extends Resource>DatabaseExceptionDBClassStore.generateNewID()
public void update(T entry)
throws DatabaseException
DBClassStore
update in interface DBClassStore<T extends Resource>DatabaseException
public T getResource(Object id)
throws DatabaseException
DBClassStore
getResource in interface DBClassStore<T extends Resource>id - the ID that is retrieved from Resource.getID()
DatabaseExceptionResource.getID()
public AbstractIterator<T> fetch(Filter<T> filter)
throws DatabaseException
fetch in interface DBClassStore<T extends Resource>DatabaseExceptionIterationException
public Object generateNewID()
throws DatabaseException
generateNewID in interface DBClassStore<T extends Resource>DatabaseExceptionObjectRowMapper.generateNewID()
public int size()
throws DatabaseException
DBClassStore
size in interface DBClassStore<T extends Resource>DatabaseException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||