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.
For example, a query of the datasource of the Customer
entity may look as follows:
select c from sales$Customer c
or
select o.customer from sales$Order o
A query cannot return single attributes or aggregates, for example:
select c.id, c.name from sales$Customer c /* invalid – returns single fields, not the whole Customer object */
If you need to execute a query which returns scalar values or aggregates and to display the results in visual components using standard data binding, use Value Datasources.