|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Persister
An interface to classes providing access to the persistent layer.
| Method Summary | |
|---|---|
void |
abortTransaction()
Aborts a transaction to cancel updates to the repository. |
void |
beginTransaction()
Begins a transaction to start updates in the repository. |
DBQuery |
buildQuery(Class clazz,
DBCriteria criteria,
boolean distinct)
Builds a query to a specified criteria for the specified class. |
DBQuery |
buildQuery(Class clazz,
String[] attributes,
DBCriteria criteria,
boolean distinct)
Builds a query to a specified criteria for the specified class returning only selected attributes. |
DBQuery |
buildQuery(Class clazz,
String expr,
boolean sql)
Builds a query to a query language expression for the specified class. |
DBQuery |
buildQuery(Object sample)
Builds a query to a sample object, an identity or a specific class. |
DBQuery |
buildQuery(String className,
DBCriteria criteria,
boolean distinct)
Builds a query to a specified criteria for the named class. |
DBQuery |
buildQuery(String className,
String[] attributes,
DBCriteria criteria,
boolean distinct)
Builds a query to a specified criteria for the named class returning only selected attributes. |
DBQuery |
buildQuery(String className,
String expr,
boolean sql)
Builds a query to a query language expression for the named class. |
void |
clearCache()
Clears the cache associated to this persister, if any. |
void |
close()
Closes the connection to the repository. |
void |
commitTransaction()
Commits a transaction to complete updates in the repository. |
void |
deleteObject(Object object)
Deletes an object from the repository. |
void |
deleteObjects(Class clazz,
DBCriteria criteria)
Deletes objects of the specified criteria and class as one transaction. |
void |
deleteObjects(Class clazz,
String attribute,
Object value,
int condition)
Deletes objects of the specified class from the repository as one transaction. |
void |
deleteObjects(Collection objects)
Deletes a collection of objects from the repository as one transaction. |
void |
deleteObjects(DBQuery query)
Deletes query objects from the repository as one transaction. |
void |
deleteObjects(String className,
DBCriteria criteria)
Deletes objects of the specified criteria and named class as one transaction. |
void |
deleteObjects(String className,
String attribute,
Object value,
int condition)
Deletes objects of the named class from the repository as one transaction. |
void |
dump(Collection objects,
File file)
Dumps a objects into a dump file if this persister supports files. |
Object |
getAdaptee()
Gets the implementation specific persister adaptee, if any. |
String |
getConnectionKey()
Gets the connection key bound to this persister. |
DBCriteria |
getCriteria()
Gets implementation specific criteria. |
DBCriteria |
getCriteria(Object criteria)
Gets initialized implementation specific criteria. |
String |
getKeyAttribute(Class clazz)
Gets the primary key attribute of the specified class. |
String |
getKeyAttribute(String className)
Gets the primary key attribute of the named class. |
String[] |
getKeyAttributes(Class clazz)
Gets the primary key attributes of the specified class. |
String[] |
getKeyAttributes(String className)
Gets the primary key attributes of the named class. |
Locale |
getLocale()
Gets the locale of this persister. |
MBeanServer |
getMBeanServer()
Gets the MBean server of this persister. |
Principal |
getPrincipal()
Gets the principal of this persister. |
String |
getRepository(String className)
Gets the name of the repository of the named class. |
void |
insertObject(Object object)
Inserts an object to the repository. |
void |
insertObjects(Collection objects)
Inserts a collection of objects to the repository as one transaction. |
boolean |
isClosed()
Checks whether this persister is closed. |
boolean |
isInTransaction()
Checks whether this persister is performing a transaction. |
boolean |
isPersistentAttribute(Class clazz,
String attribute)
Checks whether an attribute of the specified class is persistent. |
boolean |
isPersistentAttribute(String className,
String attribute)
Checks whether an attribute of the named class is persistent. |
boolean |
isTransactionsSupported()
Checks whether this persister implementation supports transactions. |
Collection |
load(File file)
Loads objects from a dump file if this persister supports files. |
Object |
queryBySample(Object sample)
Queries an object by its properties or identity. |
int |
queryCount(Class clazz,
DBCriteria criteria)
Queries the count of objects of the specified criteria and class. |
int |
queryCount(Class clazz,
String attribute,
Object value,
int condition)
Queries the count of objects of the specified class. |
int |
queryCount(DBQuery query)
Queries the count of objects the given query would return. |
int |
queryCount(String className,
DBCriteria criteria)
Queries the count of objects of the specified criteria and named class. |
int |
queryCount(String className,
String attribute,
Object value,
int condition)
Queries the count of objects of the named class. |
QueryIterator |
queryIterator(Class clazz,
DBCriteria criteria)
Queries an iterator to a collection of objects of the specified criteria and class. |
QueryIterator |
queryIterator(Class clazz,
String attribute,
Object value,
int condition)
Queries an iterator to a collection of objects of the specified class. |
QueryIterator |
queryIterator(DBQuery query)
Queries an iterator to a collection of objects. |
QueryIterator |
queryIterator(String className,
DBCriteria criteria)
Queries an iterator to a collection of objects of the specified criteria and named class. |
QueryIterator |
queryIterator(String className,
String attribute,
Object value,
int condition)
Queries an iterator to a collection of objects of the named class. |
Object |
queryObject(Class clazz,
Object value)
Queries an object of the specified class. |
Object |
queryObject(Class clazz,
String attribute,
Object value)
Queries an object of the specified class with the named attribute. |
Object |
queryObject(DBQuery query)
Queries an object. |
Object |
queryObject(String className,
Object value)
Queries an object of the named class. |
Object |
queryObject(String className,
String attribute,
Object value)
Queries an object of the named class with the named attribute. |
Collection |
queryObjects(Class clazz,
DBCriteria criteria)
Queries objects of the specified criteria and class. |
Collection |
queryObjects(Class clazz,
String attribute,
Object value,
int condition)
Queries objects of the specified class. |
Collection |
queryObjects(DBQuery query)
Queries objects. |
Collection |
queryObjects(String className,
DBCriteria criteria)
Queries objects of the specified criteria and named class. |
Collection |
queryObjects(String className,
String attribute,
Object value,
int condition)
Queries objects of the named class. |
void |
refreshReference(Object object,
String name,
boolean force)
Refreshes a named reference of the specified object. |
void |
refreshReferences(Object object,
boolean force)
Refreshes references of the specified object. |
void |
removeFromCache(Object object)
Removes the specified object from the cache. |
void |
setLocale(Locale loc)
Sets the locale of this persister. |
void |
storeObject(Object object)
Stores an object to the repository. |
void |
storeObjects(Collection objects)
Stores a collection of objects to the repository as one transaction. |
Object |
toIdentity(Object sample)
Returns an implementation specific object representing the identity of the specified sample object. |
void |
updateObject(Object object)
Updates an object in the repository. |
void |
updateObjects(Collection objects)
Updates a collection of objects in the repository as one transaction. |
| Method Detail |
|---|
String getConnectionKey()
Object getAdaptee()
void close()
boolean isClosed()
void clearCache()
void removeFromCache(Object object)
object - the object.
void refreshReferences(Object object,
boolean force)
object - the object.force - force the refresh if true, otherwise false.
void refreshReference(Object object,
String name,
boolean force)
object - the object.name - the reference attribute.force - force the refresh if true, otherwise false.Object toIdentity(Object sample)
sample - the sample object.
UnsupportedOperationException - if the sample can't be identified.String getKeyAttribute(Class clazz)
clazz - the class.
String getKeyAttribute(String className)
className - the class name.
String[] getKeyAttributes(Class clazz)
clazz - the class.
String[] getKeyAttributes(String className)
className - the class name.
boolean isPersistentAttribute(Class clazz,
String attribute)
clazz - the class.attribute - the field.
boolean isPersistentAttribute(String className,
String attribute)
className - the class name.attribute - the field.
DBCriteria getCriteria()
DBCriteria getCriteria(Object criteria)
criteria - the initial criteria.
DBQuery buildQuery(Object sample)
sample - the sample, identity or class.
DBQuery buildQuery(Class clazz,
String expr,
boolean sql)
clazz - the class to query.expr - the query expression.sql - the SQL flag.
DBQuery buildQuery(String className,
String expr,
boolean sql)
className - the class name to query.expr - the query expression.sql - the SQL flag.
DBQuery buildQuery(Class clazz,
DBCriteria criteria,
boolean distinct)
clazz - the class to query.criteria - an implementation specific criteria.distinct - a flag to indicate a distinct query.
DBQuery buildQuery(String className,
DBCriteria criteria,
boolean distinct)
className - the class name to query.criteria - an implementation specific criteria.distinct - a flag to indicate a distinct query.
DBQuery buildQuery(Class clazz,
String[] attributes,
DBCriteria criteria,
boolean distinct)
clazz - the class to query.attributes - the attributes to return.criteria - in implementation specific criteria.distinct - a flag to indicate a distinct query.
DBQuery buildQuery(String className,
String[] attributes,
DBCriteria criteria,
boolean distinct)
className - the class name to query.attributes - the attributes to return.criteria - in implementation specific criteria.distinct - a flag to indicate a distinct query.
Object queryBySample(Object sample)
throws PersisterException
sample - the sample object of identity.
PersisterException - on errors.
Object queryObject(DBQuery query)
throws PersisterException
query - the query.
PersisterException - on errors.
Object queryObject(Class clazz,
Object value)
throws PersisterException
clazz - the class to query.value - the PK of the object.
PersisterException - on errors.
Object queryObject(String className,
Object value)
throws PersisterException
className - the class name to query.value - the PK of the object.
PersisterException - on errors.
Object queryObject(Class clazz,
String attribute,
Object value)
throws PersisterException
clazz - the class to query.attribute - the name of the attribute.value - the value of the attribute.
PersisterException - on errors.
Object queryObject(String className,
String attribute,
Object value)
throws PersisterException
className - the class name to query.attribute - the name of the attribute.value - the value of the attribute.
PersisterException - on errors.
Collection queryObjects(DBQuery query)
throws PersisterException
query - the query.
PersisterException - on errors.
Collection queryObjects(Class clazz,
DBCriteria criteria)
throws PersisterException
clazz - the class to query.criteria - the criteria to apply.
PersisterException - on errors.
Collection queryObjects(String className,
DBCriteria criteria)
throws PersisterException
className - the class name to query.criteria - the criteria to apply.
PersisterException - on errors.
Collection queryObjects(Class clazz,
String attribute,
Object value,
int condition)
throws PersisterException
clazz - the class to query.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
PersisterException - on errors.
Collection queryObjects(String className,
String attribute,
Object value,
int condition)
throws PersisterException
className - the class name to query.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
PersisterException - on errors.
QueryIterator queryIterator(DBQuery query)
throws PersisterException
query - the query.
PersisterException - on errors.
QueryIterator queryIterator(Class clazz,
DBCriteria criteria)
throws PersisterException
clazz - the class to query.criteria - the criteria to apply.
PersisterException - on errors.
QueryIterator queryIterator(String className,
DBCriteria criteria)
throws PersisterException
className - the class name to query.criteria - the criteria to apply.
PersisterException - on errors.
QueryIterator queryIterator(Class clazz,
String attribute,
Object value,
int condition)
throws PersisterException
clazz - the class to query.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
PersisterException - on errors.
QueryIterator queryIterator(String className,
String attribute,
Object value,
int condition)
throws PersisterException
className - the class name to query.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criterion attribute.
PersisterException - on errors.int queryCount(DBQuery query)
query - the query.
int queryCount(Class clazz,
DBCriteria criteria)
throws PersisterException
clazz - the class to query.criteria - the criteria to apply.
PersisterException - on errors.
int queryCount(String className,
DBCriteria criteria)
throws PersisterException
className - the class name to query.criteria - the criteria to apply.
PersisterException - on errors.
int queryCount(Class clazz,
String attribute,
Object value,
int condition)
clazz - the class to query.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
int queryCount(String className,
String attribute,
Object value,
int condition)
className - the class name to query.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criterion attribute.
void storeObject(Object object)
throws PersisterException
object - the object to store.
PersisterException - on errors.
void storeObjects(Collection objects)
throws PersisterException
objects - the objects to store.
PersisterException - on errors.
void insertObject(Object object)
throws PersisterException
object - the object to insert.
PersisterException - on errors.
void insertObjects(Collection objects)
throws PersisterException
objects - the objects to insert.
PersisterException - on errors.
void updateObject(Object object)
throws PersisterException
object - the object to update.
PersisterException - on errors.
void updateObjects(Collection objects)
throws PersisterException
objects - the objects to update.
PersisterException - on errors.
void deleteObject(Object object)
throws PersisterException
object - the object to delete.
PersisterException - on errors.
void deleteObjects(Collection objects)
throws PersisterException
objects - the objects to delete.
PersisterException - on errors.
void deleteObjects(DBQuery query)
throws PersisterException
query - the query.
PersisterException - on errors.
void deleteObjects(Class clazz,
DBCriteria criteria)
throws PersisterException
clazz - the class to query.criteria - the criteria to apply.
PersisterException - on errors.
void deleteObjects(String className,
DBCriteria criteria)
throws PersisterException
className - the class name to query.criteria - the criteria to apply.
PersisterException - on errors.
void deleteObjects(Class clazz,
String attribute,
Object value,
int condition)
throws PersisterException
clazz - the class to delete.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
PersisterException - on errors.
void deleteObjects(String className,
String attribute,
Object value,
int condition)
throws PersisterException
className - the class name to delete.attribute - the name of the attribute.value - the value of the attribute.condition - the condition for the criteria.
PersisterException - on errors.boolean isTransactionsSupported()
boolean isInTransaction()
void beginTransaction()
No-op if transactions are not supported.
void abortTransaction()
No-op if transactions are not supported.
void commitTransaction()
No-op if transactions are not supported.
String getRepository(String className)
className - the class name.
Collection load(File file)
throws PersisterException
file - the dump file.
PersisterException - for loading errors.
UnsupportedOperationException - if not supported.
void dump(Collection objects,
File file)
throws PersisterException
objects - a collection of objects to dump.file - the dump file.
PersisterException - for dumping errors.
UnsupportedOperationException - if not supported.Locale getLocale()
void setLocale(Locale loc)
loc - the locale.Principal getPrincipal()
MBeanServer getMBeanServer()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||