|
IBM WebSphere Application ServerTM Release 7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Mediator
Used to retrieve a DataGraph and persists changes for an EJB schema. The mediator takes as input a request in the form of EJB queries and returns a DataGraph containing values derived from EJB cmp fields and EJB relationships.
The mediator can retrieve data either from EJB instances cached in the container or the query request can be compiled into SQL and executed directly against the datasource. A DataGraph containing deferred updates can be persisted by the mediator by either compiling into SQL updates which are applied to the datasource or by making updates against EJB instances using the EJB local interface accessor methods and the local home. The local home must contain the methods
findByPrimaryKey(and the EJB local interface must have the EJB accessor methods. If this is not the case, then a) remove (Object) create ( )
MediatorAdapter
can be used to provide a java class which will invoke
other appropriate methods.
Update processing is independent on how the DataGraph was originally retrieved. In other words it is possible to retrieve a DataGraph directly from the datasource but have the deferred updates applied through EJB's and vice versa.
applyChanges does not have to be invoked on the same mediator instance used to obtain the DataGraph. However both instances must have been created with the same or equivalent EJB query and graph schema.
Mediator methods be called in the context of either a user transaction or a container transaction.
Exceptions thrown by applyChanges may put the transaction in MUST_ROLLBACK mode and the application must ensure that a rollback occurs. This prevents any partial updates from being committed to the datastore.
Method Summary | |
---|---|
void |
applyChanges(commonj.sdo.DataObject dg)
Process the graph's change log into sql updates against the datasource based on the EJB O-R mapping. |
void |
applyChanges(commonj.sdo.DataObject dg,
MediatorAdapter adapter)
Process the graph's change log through EJB instance methods. |
commonj.sdo.DataObject |
getGraph()
Executes the EJB queries and returns the DataGraph. |
commonj.sdo.DataObject |
getGraph(java.lang.Object[] parms)
Executes the EJB queries and returns the DataGraph. |
org.eclipse.emf.ecore.EClass |
getSchema()
Returns the schema for the datagraph as the EClass of the root DataObject. |
Method Detail |
---|
org.eclipse.emf.ecore.EClass getSchema() throws QueryException
QueryException
- Message text contains details.void applyChanges(commonj.sdo.DataObject dg) throws QueryException
dg
- A graph DataObject, usually the root DataObject.
QueryException
- The message text contains details.
Typically an optimistic update collision was detected,
an attempt to update a read only DataObject or some other runtime error. Transaction
may be placed into MUST_ROLLBACK state if partial updates have been applied to datasource. Caller
must ensure that transaction is rolled back.void applyChanges(commonj.sdo.DataObject dg, MediatorAdapter adapter) throws QueryException
MediatorAdapter
can be specified to customize processing.
dg
- A graph DataObject, usually the root DataObject.adapter
- A user class that provides customized handling of log changes.
QueryException
- The message text contains details.
Typically an optimistic update collision was detected,
an attempt to update a read only DataObject or some other runtime error. Transaction
may be placed into MUST_ROLLBACK state if partial updates have been applied to datasource. Caller
must ensure that transaction is rolled back.commonj.sdo.DataObject getGraph() throws QueryException
QueryException
- The message text contains details.
A runtime error in the server or datasource.commonj.sdo.DataObject getGraph(java.lang.Object[] parms) throws QueryException
parms
- Values for the query input arguments. By convention ?1 refers to parms[0].
QueryException
- The message text contains details. Possibly a
runtime error in the server or datasource or invalid parms.
|
IBM WebSphere Application ServerTM Release 7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |