This entry is part of the Java MBO performance optimization golden rules series.
The initValue() method is the first method executed after the MBO constructor. It is typically used to initialize attributes on new records and to set default values.
The init() method is called after initValue(). It is typically used to set current attribute as read-only based on some condition.
Do not query the database or do any other expensive logic in the initValue() and init() methods.
Setting MBO or field flags that require expensive operation or fetching other needed MBOs should be done in initFieldFlagsOnMbo().
This rule should also be applied in field initialization methods. Do not initialize the value of a field in the initValue() method of another field. Each field should initialize itself in its own initValue() method.
Labels: advanced, java, mbo, performance