Skip to content
MBO Performance Tip N.2 - Use discardable MBOs when possible

MBO Performance Tip N.2 - Use discardable MBOs when possible

August 28, 2012

This entry is part of the Java MBO performance optimization golden rules series.

If an MboSet is used for traversing forward only and not to be saved make it discardable by setting the DISCARDABLE flag.
The following snippet shows how to do it.

MboSetRemote mboSet = getMboSet("ASSET");mboSet.setFlag(MboConstants.DISCARDABLE, true);MboRemote mbo=null;for(int i=0; (mbo=mboSet.getMbo(i))!=null; i++){  ...}

Using a discardable MboSet does not cache the MBOs as it fetches from the database thus minimizing JVM memory usage.
Note that discardable mbos are always read-only.



Share this:
Twitter Facebook LinkedIn