Object Query

To retrieve data from the local database, use one of the static Object Query methods in the MBO class.

Object Query methods are generated based on Object Queries defined in Unwired WorkSpace by the modeler. Object Query methods have whatever query name, parameters and return type that were defined in Unwired WorkSpace. Object Query methods return one object, or a collection of objects that match the specified search criteria defined in the Object Query.

The following examples demonstrate how to use the Object Query methods of the Customer MBO to retrieve data.

The following method retrieves all customers.

public static com.sybase.collections.ObjectList findAll()

com.sybase.collections.ObjectList customers = Customer.findAll();

The following method retrieves all customers in a certain page.

public static com.sybase.collections.ObjectList findAll(int skip, int take)

com.sybase.collections.ObjectList customers = Customer.findAll(10, 5); 

Suppose the modeler defined the following Object Query:

The preceding Object Query results in this generated method:

public static com.sybase.collections.ObjectList 
findByFirstName(String firstName)

com.sybase.collections.ObjectList customers =
Customer.findByFirstName(“fname”);