|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.root.db.PersisterAdapter<PersistenceBroker> org.norther.tammi.root.ojb.OJBPersister
public class OJBPersister
OJB specific implementation of Persister
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.norther.tammi.root.db.Persister |
---|
Persister.Action, Persister.Script |
Field Summary |
---|
Fields inherited from class org.norther.tammi.root.db.PersisterAdapter |
---|
factory |
Constructor Summary | |
---|---|
OJBPersister(String alias,
String provider,
PersistenceBroker pb,
Principal principal,
MBeanReference<OJBFactory> pbf)
Constructs a new persister. |
Method Summary | ||
---|---|---|
boolean |
abortTransaction()
Aborts a transaction to cancel updates to the repository. |
|
boolean |
beginTransaction()
Begins a transaction to start updates in the repository. |
|
|
buildQuery(Class<T> clazz,
String expr,
Persister.Script type)
Builds a query to a query language expression for the specified class. |
|
DBQuery<Object[]> |
buildQuery(DBCriteria<?> criteria,
String[] attributes,
boolean distinct,
Object... clazz)
Builds a query to a specified criteria returning only selected attributes. |
|
|
buildQuery(DBCriteria<T> criteria,
boolean distinct,
Object... clazz)
Builds a query to a specified criteria. |
|
|
buildQuery(Object sample,
DBCriteria<?>... criteria)
Builds a query to a sample object, an identity or a specific class. |
|
void |
clearCache()
Clears the cache associated to this persister, if any. |
|
Object |
clone()
Returns a clone. |
|
void |
close()
Closes the connection to the repository. |
|
boolean |
commitTransaction()
Commits a transaction to complete updates in the repository. |
|
|
createCriteria(Class<T> clazz)
Creates implementation specific query criteria for the specified class. |
|
void |
deleteObject(Object object)
Deletes an object from the repository. |
|
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 |
execute(String sql)
Executes an SQL statement. |
|
void |
execute(String[] sql)
Executes SQL statements as a batch. |
|
String[] |
getIdentityAttributes(Object sample,
String... classNames)
Gets the identity attributes of the specified sample object. |
|
String[] |
getPersistentAttributes(Object sample,
String... classNames)
Gets the persistent attributes of the specified sample object. |
|
String |
getPersistentColumn(Object sample,
String attribute,
String... classNames)
Gets the persistent column of an attribute of the specified sample object. |
|
String |
getPersistentTable(Object sample,
String... classNames)
Gets the persistent table of the specified sample object. |
|
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. |
|
protected boolean |
isAutoIncrementalAttribute(String className,
String field)
Checks whether the specified field if auto incremental. |
|
boolean |
isInTransaction()
Checks whether this persister is performing a transaction. |
|
protected boolean |
isMandatoryAttribute(String className,
String field)
Checks whether the specified field if mandatory. |
|
boolean |
isRelationAttribute(Object sample,
String attribute,
String... classNames)
Checks whether an attribute of the specified sample object is relative. |
|
boolean |
isTransactionsSupported()
Checks whether this persister implementation supports transactions. |
|
int |
queryCount(DBQuery<?> query)
Queries the count of objects the given query would return. |
|
|
queryIterator(DBQuery<T> query)
Queries an iterator to a collection of objects. |
|
|
queryObject(DBQuery<T> query)
Queries an object. |
|
|
queryObjects(DBQuery<T> query)
Queries objects. |
|
boolean |
refreshLocators(Object object,
String... classNames)
Refreshes locators of the specified object. |
|
boolean |
refreshReference(Object object,
String reference,
String... classNames)
Refreshes a named reference of the specified object. |
|
boolean |
refreshReferences(Object object,
String... classNames)
Refreshes references of the specified object. |
|
void |
removeFromCache(Object object)
Removes the specified object from the cache. |
|
void |
retrieveReference(Object object,
String reference,
String... classNames)
Retrieves a named reference of the specified object. |
|
void |
retrieveReferences(Object object,
String... classNames)
Retrieves references of the specified object. |
|
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. |
|
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. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OJBPersister(String alias, String provider, PersistenceBroker pb, Principal principal, MBeanReference<OJBFactory> pbf)
alias
- the connection alias.provider
- the provider alias.pb
- the persistence broker.principal
- the principal.pbf
- the persister factory.Method Detail |
---|
public Object clone()
Persister
clone
in interface Persister
clone
in class PersisterAdapter<PersistenceBroker>
public void close()
Persister
close
in interface Persister
close
in class PersisterAdapter<PersistenceBroker>
public void clearCache()
Persister
clearCache
in interface Persister
clearCache
in class PersisterAdapter<PersistenceBroker>
public void removeFromCache(Object object)
Persister
removeFromCache
in interface Persister
removeFromCache
in class PersisterAdapter<PersistenceBroker>
object
- the object.public void retrieveReferences(Object object, String... classNames)
Persister
Note that if dependent class names are not given, only the current class of the object is considered as a dependent class.
object
- the object.classNames
- dependent class names.public void retrieveReference(Object object, String reference, String... classNames)
Persister
Note that if dependent class names are not given, only the current class of the object is considered as a dependent class.
object
- the object.reference
- the reference attribute.classNames
- dependent class names.public boolean refreshReferences(Object object, String... classNames)
Persister
Note that if dependent class names are not given, only the current class of the object is considered as a dependent class.
refreshReferences
in interface Persister
refreshReferences
in class PersisterAdapter<PersistenceBroker>
object
- the object.classNames
- dependent class names.
public boolean refreshReference(Object object, String reference, String... classNames)
Persister
Note that if dependent class names are not given, only the current class of the object is considered as a dependent class.
refreshReference
in interface Persister
refreshReference
in class PersisterAdapter<PersistenceBroker>
object
- the object.reference
- the reference attribute.classNames
- dependent class names.
public boolean refreshLocators(Object object, String... classNames)
Persister
Note that if dependent class names are not given, only the current class of the object is considered as a dependent class.
object
- the object.classNames
- dependent class names.
public String[] getIdentityAttributes(Object sample, String... classNames)
Persister
sample
- the sample object.classNames
- the dependent class names.
public String[] getPersistentAttributes(Object sample, String... classNames)
Persister
sample
- the sample object.classNames
- the dependent class names.
public boolean isRelationAttribute(Object sample, String attribute, String... classNames)
Persister
sample
- the sample object.attribute
- the field.classNames
- the dependent class names.
public String getPersistentTable(Object sample, String... classNames)
Persister
sample
- the sample object.classNames
- the dependent class names.
public String getPersistentColumn(Object sample, String attribute, String... classNames)
Persister
sample
- the sample object.attribute
- the field.classNames
- the dependent class names.
public <T> DBCriteria<T> createCriteria(Class<T> clazz)
Persister
T
- the criteria type.clazz
- the class type.
public <T> DBQuery<T> buildQuery(Object sample, DBCriteria<?>... criteria)
Persister
T
- the query type.sample
- the sample, identity or class.criteria
- optional criteria.
public <T> DBQuery<T> buildQuery(Class<T> clazz, String expr, Persister.Script type)
Persister
T
- the class type.clazz
- the class to query.expr
- the query expression.type
- the query type.
public <T> DBQuery<T> buildQuery(DBCriteria<T> criteria, boolean distinct, Object... clazz)
Persister
Note that the signature must differ from that of a sample query to avoid conflicts.
T
- the class type.criteria
- an implementation specific criteria.distinct
- true for a distinct query, false otherwise.clazz
- an alternate class or class name.
public DBQuery<Object[]> buildQuery(DBCriteria<?> criteria, String[] attributes, boolean distinct, Object... clazz)
Persister
criteria
- in implementation specific criteria.attributes
- the attributes to return.distinct
- true for a distinct query, false otherwise.clazz
- an alternate class or class name.
public <T> T queryObject(DBQuery<T> query) throws PersistenceException
Persister
T
- the query type.query
- the query.
PersistenceException
- on errors.public <T> Collection<T> queryObjects(DBQuery<T> query) throws PersistenceException
Persister
T
- the query type.query
- the query.
PersistenceException
- on errors.public <T> QueryIterator<T> queryIterator(DBQuery<T> query) throws PersistenceException
Persister
T
- the query type.query
- the query.
PersistenceException
- on errors.public int queryCount(DBQuery<?> query)
Persister
query
- the query.
public void storeObject(Object object) throws PersistenceException
Persister
object
- the object to store.
PersistenceException
- on errors.public void storeObjects(Collection<?> objects) throws PersistenceException
Persister
objects
- the objects to store.
PersistenceException
- on errors.public void insertObject(Object object) throws PersistenceException
Persister
object
- the object to insert.
PersistenceException
- on errors.public void insertObjects(Collection<?> objects) throws PersistenceException
Persister
objects
- the objects to insert.
PersistenceException
- on errors.public void updateObject(Object object) throws PersistenceException
Persister
object
- the object to update.
PersistenceException
- on errors.public void updateObjects(Collection<?> objects) throws PersistenceException
Persister
objects
- the objects to update.
PersistenceException
- on errors.public void deleteObject(Object object) throws PersistenceException
Persister
object
- the object to delete.
PersistenceException
- on errors.public void deleteObjects(Collection<?> objects) throws PersistenceException
Persister
objects
- the objects to delete.
PersistenceException
- on errors.public void deleteObjects(DBQuery<?> query) throws PersistenceException
Persister
query
- the query.
PersistenceException
- on errors.public void execute(String sql) throws PersistenceException
Persister
Note that open transactions may be committed as a side effect.
sql
- the statement.
PersistenceException
- on errors.public void execute(String[] sql) throws PersistenceException
Persister
Note that open transactions may be committed as a side effect.
sql
- the statements.
PersistenceException
- on errors.public boolean isTransactionsSupported()
Persister
isTransactionsSupported
in interface Persister
isTransactionsSupported
in class PersisterAdapter<PersistenceBroker>
public boolean isInTransaction()
Persister
isInTransaction
in interface Persister
isInTransaction
in class PersisterAdapter<PersistenceBroker>
public boolean beginTransaction()
Persister
Nop if transactions are not supported.
beginTransaction
in interface Persister
beginTransaction
in class PersisterAdapter<PersistenceBroker>
public boolean abortTransaction()
Persister
Nop if transactions are not supported.
abortTransaction
in interface Persister
abortTransaction
in class PersisterAdapter<PersistenceBroker>
public boolean commitTransaction()
Persister
Nop if transactions are not supported.
commitTransaction
in interface Persister
commitTransaction
in class PersisterAdapter<PersistenceBroker>
public String getRepository(String className)
Persister
getRepository
in interface Persister
getRepository
in class PersisterAdapter<PersistenceBroker>
className
- the class name.
protected boolean isMandatoryAttribute(String className, String field)
PersisterAdapter
isMandatoryAttribute
in class PersisterAdapter<PersistenceBroker>
className
- the class name.field
- the field name.
protected boolean isAutoIncrementalAttribute(String className, String field)
PersisterAdapter
isAutoIncrementalAttribute
in class PersisterAdapter<PersistenceBroker>
className
- the class name.field
- the field name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |