Operating Systems: i5/OS
             Personalize the table of contents and search results

 

Use the Enterprise JavaBeans data mediator service for data access

 

The following steps use code samples to describe a simple instance of how to create the Enterprise JavaBeans data mediator service (DMS) metadata.

 

Procedure

  1. A mediator instance is created using one of the create methods on the mediator factory (com.ibm.websphere.sdo.mediator.ejb.MediatorFactory) as in the following example

    import com.ibm.websphere.sdo.mediator.ejb.Mediator;
    import com.ibm.websphere.sdo.mediator.ejb.MediatorFactory;
    import com.ibm.webpshere.ejbquery.QueryException;
    import commonj.sdo.DataObject;
    
    try{
     String[] query =  { "select d.deptno,d.name from DeptBean as d" }; 
     Mediator m = MediatorFactory.getInstance().createMediator( query, null);
     DataObject root = m.getGraph();
    } catch (QueryException e) { ... } 

  2. There are 3 different forms of the createMediator method. The arguments are explained below.

    createMediator( query, parms) 
    createMediator( query, parms, schema )
    createMediator( query, parms, schema,  typeMap,  pattern)

    The arguments to the createMediator method are:

    String query array of EJB query statements
    Object parms values for input parameters of the query statements
    Eclass* schema the EClass of the root DataObject
    Map* typeMap a java.util.Map that maps EJB Abstract Schema Names from the query statement into Eclass names
    int* pattern the pattern used for containment
     
    * used only when using caller provided schema




}
Enterprise JavaBeans Data Mediator Service

 

Related Reference


DataGraph schema
Example: Using query arguments with EJB mediator