| java.lang.Object org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl org.apache.ojb.broker.core.PersistenceBrokerImpl
All known Subclasses: org.apache.ojb.broker.prevayler.PBPrevaylerImpl,
Method Summary | |
public synchronized void | abortTransaction() Abort and close the transaction. | public void | addMtoNImplementor(MtoNImplementor m2n) | public synchronized void | beginTransaction() begin a transaction against the underlying RDBMS. | public void | checkRefreshRelationships(Object obj, Identity oid, ClassDescriptor cld) Check if the references of the specified object have enabled
the refresh attribute and refresh the reference if set true. | public void | clearCache() clears the brokers internal cache.
removing is recursive. | public boolean | close() | public synchronized void | commitTransaction() Commit and close the transaction. | public Object | createProxy(Class baseClassForProxy, Identity realSubjectsIdentity) Creates a proxy instance.
Parameters: baseClassForProxy - The base class that the Proxy should extend. | public void | delete(Object obj, boolean ignoreReferences) Deletes the concrete representation of the specified object in the underlying
persistence system. | public void | delete(Object obj) | public void | deleteByQuery(Query query) | public void | deleteMtoNImplementor(MtoNImplementor m2nImpl) | public void | destroy() Release all resources used by this
class - CAUTION: No further operations can be
done with this instance after calling this method. | public Object | doGetObjectByIdentity(Identity id) Internal used method to retrieve object based on Identity. | protected void | finalize() | public ClassDescriptor | getClassDescriptor(Class clazz) returns a ClassDescriptor for the persistence capable class clazz.
throws a PersistenceBrokerException if clazz is not persistence capable,
i.e. | public ManageableCollection | getCollectionByQuery(Class collectionClass, Query query) | public Collection | getCollectionByQuery(Query query) | public int | getCount(Query query) | public DescriptorRepository | getDescriptorRepository() | public MaterializationCache | getInternalCache() | public Iterator | getIteratorByQuery(Query query) returns an Iterator that iterates Objects of class c if calling the .next()
method. | protected OJBIterator | getIteratorFromQuery(Query query, ClassDescriptor cld) | public Object | getObjectByIdentity(Identity id) | public Object | getObjectByQuery(Query query) retrieve an Object by query
I.e perform a SELECT ... | public PBKey | getPBKey() | public Enumeration | getPKEnumerationByQuery(Class primaryKeyClass, Query query) returns an Enumeration of PrimaryKey Objects for objects of class DataClass.
The Elements returned come from a SELECT ... | public ProxyFactory | getProxyFactory() | public QueryReferenceBroker | getReferenceBroker() | public RelationshipPrefetcherFactory | getRelationshipPrefetcherFactory() | public Iterator | getReportQueryIteratorByQuery(Query query) | public Class | getTopLevelClass(Class clazz) | public boolean | hasClassDescriptor(Class clazz) | public boolean | isClosed() | public boolean | isInTransaction() returns true if the broker is currently running a transaction. | public boolean | isManaged() If true this instance is handled by a managed
environment - registered within a JTA transaction. | public void | link(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject, boolean insert) Assign FK value to target object by reading PK values of referenced object. | public void | linkMtoN(Object obj, CollectionDescriptor cod, boolean insert) Assign FK values and store entries in indirection table
for all objects referenced by given object. | public void | linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert) Assign FK value to all n-side objects referenced by given object. | public void | linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert) Assign FK value of main object with PK values of the reference object. | public org.odbms.Query | query() | public void | refresh() Lookup the current
DescriptorRepository for
this class. | public void | removeFromCache(Object objectOrIdentity) | public void | retrieveAllReferences(Object pInstance) Retrieve all References (also Collection-attributes) of a given instance. | public void | retrieveReference(Object pInstance, String pAttributeName) retrieve a single reference- or collection attribute
of a persistent instance. | public BrokerHelper | serviceBrokerHelper() | public ConnectionManagerIF | serviceConnectionManager() | public IdentityFactory | serviceIdentity() | public JdbcAccess | serviceJdbcAccess() | public ObjectCache | serviceObjectCache() | public SequenceManager | serviceSequenceManager() | public SqlGenerator | serviceSqlGenerator() | public StatementManagerIF | serviceStatementManager() | public void | setClosed(boolean closed) | public void | setInTransaction(boolean inTransaction) | public void | setManaged(boolean managed) Set true if this instance is registered within a
JTA transaction. | public void | setPBKey(PBKey key) | public void | store(Object obj) Store an Object. | public void | store(Object obj, Identity oid, ClassDescriptor cld, boolean insert, boolean ignoreReferences) Method which start the real store work (insert or update)
and is intended for use by top-level api or internal calls.
Parameters: obj - The object to store. Parameters: oid - The Identity of the object to store. Parameters: cld - The org.apache.ojb.broker.metadata.ClassDescriptor of the object. Parameters: insert - If true an insert operation will be performed, else update operation. Parameters: ignoreReferences - With this flag the automatic storing/linkingof references can be suppressed (independent of the used auto-update setting in metadata),except org.apache.ojb.broker.metadata.SuperReferenceDescriptorthese kind of reference (descriptor) will always be performed. | protected void | store(Object obj, Identity oid, ClassDescriptor cld, boolean insert) Internal used method which start the real store work. | public void | store(Object obj, ObjectModification mod) Makes object obj persistent in the underlying persistence system.
E.G. | public void | unlinkFK(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds) Unkink FK fields of target object. | public void | unlinkXtoN(Object obj, CollectionDescriptor col) |
abortTransaction | public synchronized void abortTransaction() throws TransactionNotInProgressException(Code) | | Abort and close the transaction.
Calling abort abandons all persistent object modifications and releases the
associated locks.
If transaction is not in progress a TransactionNotInProgressException is thrown
|
beginTransaction | public synchronized void beginTransaction() throws TransactionInProgressException, TransactionAbortedException(Code) | | begin a transaction against the underlying RDBMS.
Calling beginTransaction multiple times,
without an intervening call to commitTransaction or abortTransaction ,
causes the exception TransactionInProgressException to be thrown
on the second and subsequent calls.
|
clearCache | public void clearCache() throws PersistenceBrokerException(Code) | | clears the brokers internal cache.
removing is recursive. That is referenced Objects are also
removed from the cache, if the auto-retrieve flag is set
for obj.getClass() in the metadata repository.
|
commitTransaction | public synchronized void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException(Code) | | Commit and close the transaction.
Calling commit commits to the database all
UPDATE, INSERT and DELETE statements called within the transaction and
releases any locks held by the transaction.
If beginTransaction() has not been called before a
TransactionNotInProgressException exception is thrown.
If the transaction cannot be commited a TransactionAbortedException exception is thrown.
|
createProxy | public Object createProxy(Class baseClassForProxy, Identity realSubjectsIdentity)(Code) | | Creates a proxy instance.
Parameters: baseClassForProxy - The base class that the Proxy should extend. For dynamic Proxies, the method of generation is dependent on the ProxyFactory implementation. Parameters: realSubjectsIdentity - The identity of the subject An instance of the proxy subclass throws: PersistenceBrokerException - If there is an error creating the proxy object |
delete | public void delete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException(Code) | | Deletes the concrete representation of the specified object in the underlying
persistence system. This method is intended for use in top-level api or
by internal calls.
Parameters: obj - The object to delete. Parameters: ignoreReferences - With this flag the automatic deletion/unlinkingof references can be suppressed (independent of the used auto-delete setting in metadata),except org.apache.ojb.broker.metadata.SuperReferenceDescriptorthese kind of reference (descriptor) will always be performed. If trueall "normal" referenced objects will be ignored, only the specified object is handled. throws: PersistenceBrokerException - |
destroy | public void destroy()(Code) | | Release all resources used by this
class - CAUTION: No further operations can be
done with this instance after calling this method.
|
finalize | protected void finalize()(Code) | | |
getClassDescriptor | public ClassDescriptor getClassDescriptor(Class clazz) throws PersistenceBrokerException(Code) | | returns a ClassDescriptor for the persistence capable class clazz.
throws a PersistenceBrokerException if clazz is not persistence capable,
i.e. if clazz is not defined in the DescriptorRepository.
|
getIteratorByQuery | public Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException(Code) | | returns an Iterator that iterates Objects of class c if calling the .next()
method. The Elements returned come from a SELECT ... WHERE Statement
that is defined by the Query query.
If itemProxy is null, no proxies are used.
|
getPKEnumerationByQuery | public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException(Code) | | returns an Enumeration of PrimaryKey Objects for objects of class DataClass.
The Elements returned come from a SELECT ... WHERE Statement
that is defined by the fields and their coresponding values of listFields
and listValues.
Useful for EJB Finder Methods...
Parameters: primaryKeyClass - the pk class for the searched objects Parameters: query - the query |
hasClassDescriptor | public boolean hasClassDescriptor(Class clazz)(Code) | | |
isClosed | public boolean isClosed()(Code) | | |
isInTransaction | public boolean isInTransaction()(Code) | | returns true if the broker is currently running a transaction.
boolean |
isManaged | public boolean isManaged()(Code) | | If true this instance is handled by a managed
environment - registered within a JTA transaction.
|
linkMtoN | public void linkMtoN(Object obj, CollectionDescriptor cod, boolean insert)(Code) | | Assign FK values and store entries in indirection table
for all objects referenced by given object.
Parameters: obj - real object with 1:n reference Parameters: cod - CollectionDescriptor of referenced 1:n objects Parameters: insert - flag signal insert operation, false signals update operation |
linkOneToMany | public void linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert)(Code) | | Assign FK value to all n-side objects referenced by given object.
Parameters: obj - real object with 1:n reference Parameters: cod - CollectionDescriptor of referenced 1:n objects Parameters: insert - flag signal insert operation, false signals update operation |
linkOneToOne | public void linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert)(Code) | | Assign FK value of main object with PK values of the reference object.
Parameters: obj - real object with reference (proxy) object (or real object with set FK values on insert) Parameters: cld - ClassDescriptor of the real object Parameters: rds - An ObjectReferenceDescriptor of real object. Parameters: insert - Show if "linking" is done while insert or update. |
retrieveAllReferences | public void retrieveAllReferences(Object pInstance) throws PersistenceBrokerException(Code) | | Retrieve all References (also Collection-attributes) of a given instance.
Loading is forced, even if the collection- and reference-descriptors differ.
Parameters: pInstance - the persistent instance to work with |
retrieveReference | public void retrieveReference(Object pInstance, String pAttributeName) throws PersistenceBrokerException(Code) | | retrieve a single reference- or collection attribute
of a persistent instance.
Parameters: pInstance - the persistent instance Parameters: pAttributeName - the name of the Attribute to load |
setClosed | public void setClosed(boolean closed)(Code) | | |
setInTransaction | public void setInTransaction(boolean inTransaction)(Code) | | |
setManaged | public void setManaged(boolean managed)(Code) | | Set true if this instance is registered within a
JTA transaction. On
PersistenceBrokerImpl.close() call this flag was reset
to false automatic.
|
store | public void store(Object obj, Identity oid, ClassDescriptor cld, boolean insert, boolean ignoreReferences)(Code) | | Method which start the real store work (insert or update)
and is intended for use by top-level api or internal calls.
Parameters: obj - The object to store. Parameters: oid - The Identity of the object to store. Parameters: cld - The org.apache.ojb.broker.metadata.ClassDescriptor of the object. Parameters: insert - If true an insert operation will be performed, else update operation. Parameters: ignoreReferences - With this flag the automatic storing/linkingof references can be suppressed (independent of the used auto-update setting in metadata),except org.apache.ojb.broker.metadata.SuperReferenceDescriptorthese kind of reference (descriptor) will always be performed. If trueall "normal" referenced objects will be ignored, only the specified object is handled. |
store | public void store(Object obj, ObjectModification mod) throws PersistenceBrokerException(Code) | | Makes object obj persistent in the underlying persistence system.
E.G. by INSERT INTO ... or UPDATE ... in an RDBMS.
The ObjectModification parameter can be used to determine whether INSERT or update is to be used.
This functionality is typically called from transaction managers, that
track which objects have to be stored. If the object is an unmaterialized
proxy the method return immediately.
|
|
|