Quering and fetching MBOs

This entry is part of the Maximo Java Development series.

To query a Maximo table using Java you need to perform the following steps:
  1. Get a reference to the MboSet.
  2. Specify a where clause.
  3. Loop through the MboSet and fetch Mbos.
The following example shows how to retrieve all the assets located in BEDFORD site.

MboSetRemote assetSet = getMboSet("ASSET");
assetSet.setWhere("LOCATION='BEDFORD'");
MboRemote asset=null;
for(int i=0; (asset=assetSet.getMbo(i))!=null; i++)
{
...
}

  • The getMboSet method gets a reference the ASSET table.
  • The setWhere method specifies the SQL where clause that must be applied to filter data. If the setWhere is not invoked, the entire table will be fetched.
  • The getMbo method returns a specific element of the MboSet collection. The first invocation of getMbo method automatically fetches data and initialize the MboSet.


Comments