EJB data mediator service programming considerations

When you begin writing your applications to take advantage of the Enterprise JavaBeans (EJB) data mediator service (DMS) provided in the product, consider the following items.

EJB programming model

Only a subset of the EJB programming model is supported by the EJB data mediator service.
  • When using EJB collection parameters to retrieve data from EJB instances, or when using applyChanges to update EJB instances:
    • The EJB DMS uses local interfaces for enterprise beans. Getter and setter calls for container-managed persistence (CMP) fields must be promoted to the local interface, as well as any EJB methods used in query expressions.
    • For the mediator to create an EJB, there must be a create method using the primary key class as the only argument method defined on the EJB home. If no such method exists, you must supply an adapter that handles the create operation. Also, the EJBLocalHome interface defined for the EJB must include (in addition to the create method) the following method:
      findByPrimaryKey(<key class>)
      remove (java.lang.Object)
      create (<key class>)
      
  • When invoking the applyChanges method directly to the database, the following occur:
    • you bypass container update. You should force a refresh as soon as possible by transaction termination and using appropriate container cache options.
    • you bypass EJB container-managed relationship (CMR) maintenance. You must rely on database RI to maintain those relationships not retrieved into the DataGraph.
  • CMP fields must be the allowed types. See EJB mediator query syntax for a list of those types.
  • CMP fields of user-defined types that use EJB converters/composer are not supported.
Table 1. EJB programming model limitations with EJB DMS. The following table shows limitations in the EJB programming model that are not supported by the EJB DMS.
  retrieve direct from db retrieve from EJB Container update direct to db update through EJB
EJB persistence inheritance No No No No
EJB cmp field with converter No Yes No Yes

Transactional

Access intent

Best practices




Related tasks
Using the EJB data mediator service for data access
Related reference
EJB data mediator service data retrieval
EJB data mediator service data update
EJB mediator query syntax
DataGraph schema
Reference topic    

Terms of Use | Feedback

Last updated: Oct 20, 2010 7:53:43 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-nd-dist&topic=rejb_ejbmedpcon
File name: rejb_ejbmedpcon.html