4.5.3.2.1. Returned values
A query should return entities of the type which is specified at the moment of creating a datasource. In case of declarative creation, the entity type is specified in the class
attribute of an XML element, if DsBuilder
is used – in the setJavaClass()
or setMetaClass()
method.
Furthermore, the object type in the from
query statement should match the datasource entity type. This is necessary for automatic query transformations.
For example, a query of the datasource of the Customer
entity may look as follows:
select c from sales$Customer c
Below are examples of invalid queries for a datasource of the Customer
entity:
select c.id, c.name from sales$Customer c /* invalid – returns single fields, not the whole Customer object */
select o.customer from sales$Order o /* invalid – the 'from' type (Order) is different from the resulting type (Customer) */