Understand how to define object queries.
Since object queries can run on multiple mobile devices that may run different compact databases (UltraLiteJ® or SQLite® for example), object queries support a subset of UltraLiteJ SQL statements.
| SQL | Restrictions |
|---|---|
| Select statement |
Supported – Order by Unsupported:
|
| Input-parameter |
Supported – :name |
| Comparison operators | Supported:
|
| From clause | Supports multiple MBOs. |
See the UltraLiteJ documentation for more information about the UltraLite SELECT statement clauses.
SELECT c.* from Cust c WHERE c.cust_id = :cust_id
results in an object query that returns a single row from the Customer table. You must use an alias (c and c.attribute_name) in the query definition or an error occurs during code generation.
General object query behavior, including assigning parameters a default value/primary key includes:
java.sql.SQLException:JZ008: invalid column index value at 2
Parameter: Param1 (INT)
Query definition: SELECT x.* FROM TravelRequest x WHERE x.trvl_Id = :param1