Using 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 three different forms of the createMediator method. The arguments are explained as follows:
    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



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Sep 20, 2010 11:08:29 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=vela&product=was-nd-mp&topic=tejb_ejbmeduse
File name: tejb_ejbmeduse.html