Object Queries

Use the generated static methods in the MBO classes to retrieve MBO instances.

  1. To find all instances of an MBO, invoke the static findAll method contained in that MBO. For example, an MBO named Customer contains a method such as public static com.sybase.collections.GenericList<SUP101.Customer> findAll().
  2. To find a particular instance of an MBO using the primary key, invoke MBO.findByPrimaryKey(...). For example, if a Customer has the primary key "id" as int, the Customer MBO would contain the public static Customer findByPrimaryKey(int id) method, which performs the equivalent of Select x.* from Customer x where x.id = :id.
If the return type is a list, additional methods are generated for you to further process the result, for example, to use paging. For example, consider this method, which returns a list of MBOs containing the specified city name: com.sybase.collections.GenericList<SUP101.Customer> findByCity(String city, int skip, int take);. The skip parameter specifies the number of rows to skip, and the take parameter specifies the maximum number of rows to return.
Related concepts
Accessing MBO Data
Related reference
Query APIs