EJB mediator query syntax
The mediator query is an array of EJB query statements. There is a query statement for each node type in the DataGraph. Each query specifies search predicates, the container managed persistence (CMP) fields or expressions to project into the DataObject, and which EJB relationships to use to construct DataObject references. The EJB query statements follow normal rules and conventions for EJB query with the addition of the following rules:
- The FROM clause contains only one element. This is a path expression where the source is defined by a query statement earlier in the array of query statements.
- The first query statement FROM clause references either an EJB Abstract Schema Name (ASN) or an EJB collection parameter.
- An EJB type can appear in only one FROM clause except for subselects. The FROM clauses of the queries must form a hierarchy where no EJB type appears more than once, and there is one and only one path to an EJB type.
- The SELECT clause can specify a list of CMP fields to retrieve ( the wildcard * notation can be used to retrieve all CMP fields) or valid EJB query language expressions. CMP fields and expressions must be one of the following types:
- Primitive types: boolean, byte, short, integer, long, float, double, char
- Object wrapper types for the primitive types
- Java.lang.String
- Java.math.BigDecimal
- java.math.BigInteger
- byte [ ]
- Java.sql.Date
- java.sql.Time
- java.sql.Timestamp
- java.util.Date
- java.util.Calendar
- All primary key CMP fields must be retrieved in order for the Service Data Objects (SDO) to be updateable, otherwise applyChanges causes an exception.
- SDO attributes that come from EJB query language expressions such as e.salary + e.bonus AS TOTAL_PAY cannot be updated. If you try to make an update, applyChanges causes a QueryException.
- Aggregate expressions such as SUM(e.salary) are not allowed even though they are part of the EJB query language. Aggregate expressions can be used in subselects in the WHERE clause.
See also
Example: EJB mediator query arguments