Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Relationships to non-persistent tables/attributes have blank WHERE clauses

    Posted Sat September 11, 2021 02:56 AM
    MAM 7.6.1.2:

    Why do relationships to non-persistent tables and attributes usually have blank WHERE clauses?
    I don't think I understand how a relationship without a WHERE clause could function properly/be useful. How would Maximo know what fields to join on?



    Thanks.


    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: Relationships to non-persistent tables/attributes have blank WHERE clauses

    Posted Mon September 13, 2021 08:04 AM
    Non-persistent objects don't exist in the database so there is no need to query to find them. That means you'll typically see a blank, though sometimes you might see 1=1 or something like that. The setup method in the java class of the non-persistent object in these scenarios are designed to "generate" the records based on the owner, sometimes even based on the relationship name. For example, WOTOTAL will get the WO owner and then add new MBOs to the WOTOTAL set based on the summation of Internal Labor Hours, External Labor Hours, etc. That set will only ever contain records for that specific WO so there is no need to filter it.


    ------------------------------
    Steven Shull
    ------------------------------



  • 3.  RE: Relationships to non-persistent tables/attributes have blank WHERE clauses

    Posted Mon September 13, 2021 08:29 AM
    Edited by System Admin Wed March 22, 2023 11:51 AM

    Thanks Steven!

    When you say "...WOTOTAL will get the WO owner...", does owner in that case refer to the MBO as the owner?
    (I'm not terribly familiar with that MBO/owner concept yet.)

    I ask because I'm currently working on a related challenge here: Use WOTOTAL non-persistent object in WOTRACK

    #Maximo
    #AssetandFacilitiesManagement


  • 4.  RE: Relationships to non-persistent tables/attributes have blank WHERE clauses

    Posted Mon September 13, 2021 09:24 AM
    Mbo represents a single record and a MboSet is a collection of Mbos. A Mbo record will typically get a child object by calling:
    mbo.getMboSet("RELATIONNAME")

    That set may contain 0 to many Mbos of that child object. By default, and for the most part always, the owner of the MboSet and every Mbo in that child set is the Mbo that opened the set. So when the WOTOTAL set or one of the child Mbos calls getOwner() it will get the WO.

    There are other ways to open a set, such as using MXServer to get a set. In these cases the owner will return null (Java)/None (Jython) because there is no owning object.  

    Your scenario is interesting and I can recreate it. I honestly don't know the UI framework well enough to be able to explain it. The setup method of WOTotalSet gets the owning WO which I think the owner MBO would still be set on the list tab and would definitely be set on the main details tab. There is no bean class referenced on the dialog which means that no special logic is occurring on the dialog itself. This makes me think that a non-persistent object's setup event is not called except in certain circumstances (such as inside of a table). If I add a table to the main WO details screen I see the results so I'm pretty confident it needs to be in a dialog/table for it to call the setup event.

    ------------------------------
    Steven Shull
    ------------------------------