|
Notes on New Component Lazy Loading Functionality
These notes were originally posted in an OTN forum thread by Sung Im on our team.
In 9.0.3.4, 9.0.4.0, and 10g, BC4J introduced capability by which an ApplicationModule's components are lazily loaded.
For example, suppose we have an AM with 5 VOs and 3 nested AMs in it (as defined in the AM wizard's data model panel in the IDE). When the load-components-lazily flag is turned off (which is the default), when the AM is created, all 5 VOs and 3 nested AMs inside the AM are created.
If this flag is turned on, then the AM is created without any of its components. If you make a call to find these components, e.g., findViewObject, findApplicationModule, the component is instantiated.
You can turn on load-components-lazily by using a configuration property
jbo.load.components.lazily=true
You can use the -D JVM flag to set this property as in:
java -Djbo.load.components.lazily=true ...
Things to Note About This Feature
-
If you want this turned on only for a specific AM definition, you need to edit the AM def's XML file. Add an XML attribute: LoadComponentsLazily="true" In the current versions, there is no wizard support for this. The next major JDeveloper release will add support for this.
-
If you call AM interface methods like getViewObjectNames(), getApplicationModuleNames(), they return a list of instantiated components. I.e., they do not include names of yet-to-be created instances.
-
Even if a component of a specific name has not yet been created, if you try to create a new component through runtime API with the same name (e.g., createViewObject), you will get a NameClashException. I.e., the fact that you have not yet created a component doesn't mean that you can use that name.
-
Another way you can cause components to be created lazily is by generating Java file for the AM impl class and then overridding:
public boolean isLoadComponentsLazily() { return true; }
-
If load-components-lazily is turned on and if you load a VO which is a detail in a data model ViewLink (within an AM), you may not see master-detail coordination. You need to load (using findViewLink/findViewObject) the VL and master VO first. In the next release, the VL and master VO will be loaded automatically. For now, you need to manage this manually.
|