BC4J Helper by Sung Im
Thoughts on how BC4J works, code samples, and other helpful techniques
        

Loading AM Components Lazily (New Feature in 9.0.3.4)

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 >>

1. If you want this turned on a specif 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 release will add this.

2. 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.

3. 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.

4. 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;
      }

5. 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.



© Copyright 2004 Sung Im. Click here to send an email to the editor of this weblog.
Last update: 5/25/04; 10:23:29 AM.