IBM Support

Maximo best practice - correct use of unique ids in java code to avoid possible bugs

Technical Blog Post


Abstract

Maximo best practice - correct use of unique ids in java code to avoid possible bugs

Body

1. Java code

In Maximo java classes we don't always use the right method to get the unique id value: it always has to be getLong("<uniqid>") .
In the recent code you may find getInt (mostly), getDouble, or even getString to get the unique id value, which can lead to run time errors (and PMRs) in the future (we already fixed (and hotfixed) many issues happening because of that).
 
2. Metadata
 
Sometime in MAXATTRIBUTE table we don't have sameas definition (sameasobject=null, sameasattribute=null) for the attributes where we store a reference to a related table data (its unique id).
For ex.: PURCHVIEW / CONTRACTID is a reference to  CONTRACT / CONTRACTID. 
In this case integrity checker doesn't validate the maxtype of this attribute.

Please run the following statement to find such an issue

select a.objectname, a.attributename, a.maxtype, t.tablename, t.uniquecolumnname ,b.maxtype
from maxattribute a, maxtable t, maxattribute b
where a.attributename = t.uniquecolumnname
and a.objectname <> t.tablename
and a.sameasobject is null
and b.attributename = a.attributename
and b.objectname = t.tablename
and a.maxtype <> b.maxtype
order by 2, 1;

This select above is our "best guess" statement. If you know other broken MAXTYPE definition related to BIGINT - please fix it, too.  A couple of examples we found that are not in this list is LONGDESCRIPTION/LDKEY and DOCLINKS/OWNERID.

 
 

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

UID

ibm11133205