At the heart of Maximo Java development is the MBO and at the heart of the MBO are the relationships between one object and another. Bruno has a great write up on MBO relationships to get a better understanding of how relationships work.
For the most part, each object in Maximo should already have a relationship defined for most child objects, but in those scenarios where there is no out-of-the-box relationship, you can create one on-the-fly when working with java MBO’s.
Here is an example, in the code below, let’s say our ‘mbo’ variable is the Asset object which means there is a property on that object named “ASSETNUM” and “SITEID”. This code will create a relationship between the ASSET object and the WORKORDER object based on the query provided and return a set of zero or more WORKORDER objects.
MboSet workOrderSet = mbo.getMboSet("$ASSET2WO", "WORKORDER", "ASSETNUM = :ASSETNUM AND SITEID = :SITEID");
So what does this mean? The parameter ‘$ASSET2WO’ is an arbitrary name given to this relationship, the ‘WORKORDER’ is the child object, and the ‘ASSETNUM = :ASSETNUM AND SITEID = :SITEID’ is the relationship where clause. This where clause uses dynamic variables (values that begin with ‘:’), so the ‘:ASSETNUM’ and ‘:SITEID’ are values that are populated from the parent MBO object, in this case, the Asset object.