Dive into BC4J and ADF

Send me a mail
 Dive into BC4J and ADF    Click to see the XML version of this web page.   (Updated: 6/3/2006; 11:50:17 AM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper 10g

Search blog with Google:
 

Search BC4J JavaDoc:
 

December 2003
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Nov   Jan

Get Firefox!

Tuesday, December 02, 2003

Before 9.0.3.3, the ViewLink Consistency feature only worked for view objects having a single updateable entity usage which happened to be details of an active ViewLink. Customers understandably asked for a more useful behavior in which view objects at any level (details or not) would be kept consistent with new rows inserted through any other view object sharing the same entity usages. The 9.0.3.3 release of BC4J added support for this customer request so that ViewLink Consistency works for any view object having a single updateable entity.

Combining the ViewLink Consistency feature with view objects that have two-or-more updateable entity usages currently can produce unexpected results because the framework does not yet provide enough user-pluggable API's to control how the multiple new entity parts in these viewlink-consistency-created view row should be handled.

For example, imagine a view object named "InsertNewDeptAndFirstEmp" with updateable entity usages for both Emp and Dept entity objects. Now consider two other view objects named "AllEmployees" and "AllDepartments" that each has a single updateable entity usage for the Emp and Dept entities, respectively. If you have view link consistency mode turned on for both of these views, then the following will happen in 9.0.3.3:

  1. If you insert a new department and new employee in the InsertNewDeptAndFirstEmp view by creating a new row there, then a new row will be automatically added to the AllEmployees view to reflect that new employee and a new row will be added to the AllDepartments view to reflect that new deparment.
     
  2. If you insert a new employee in the AllEmployees  view, a new row will be created in the InsertNewDeptAndFirstEmp  view (having the entity part corresponding to the newly inserted employee, and a new Dept entity for its Dept entity part.)
     
  3. If you insert a new employee in the AllDepartments  view, a new row will be created in the InsertNewDeptAndFirstEmp  view (having the entity part corresponding to the newly inserted department, and a new Emp entity for its Emp entity part.)

There's a very good chance that behaviors number 2 and 3 above are not really what you want in your application. Until we add more fine-grained control in our framework API's for letting the developer decide how the multiple underlying entity parts of each viewlink-consistency-created view row should be handled in an application-specific manner, it's recommended to use view link consistency only for view objects with a single updateable entity usage.

The default value (of 'DEFAULT') for the BC4J configuration property jbo.viewlink.consistent property guarantees that the framework will treat:

  • View objects with a single updateable entity usage as viewlink consistent, and
  • View objects with two-or-more updateable entity usages as NOT viewlink consistent

However, actually getting BC4J 9.0.3.3 to use this default setting is a little more complicated than you might expect due to the fact that we wanted to guarantee that upon upgrading existing applications to 9.0.3.3 that the existing pre-9.0.3.3 behavior would be maintained for backward compatibility.

In 9.0.3.3 there is an entry in the ./oracle/jbo/server/jboserver.properties file (which is archived into the ./BC4J/lib/bc4jmt.jar file) that reads:

# view link consistency setting 
# The default in 903 is false.
# This flag is set to 'default' in 904 to imply that
# consistency is turned on for VOs with one updateable Entities.
## For the rest, an app developer has to make this call.
jbo.viewlink.consistent = false

If the jbo.viewlink.consistent property is left at its default value of 'DEFAULT' in the configuration, it is not recorded in the bc4j.xcfg file since the runtime framework knows the value of the default. However, BC4J uses a layered scheme to determine the value of each of its many configuration parameters at runtime which follows the following precedence rules. The first location in the ordered list below at which a given configuration parameter is found will define its  value at runtime:

  1. Client environment (set programmatically or driven by contents of named configuration in bc4j.xcfg file)
  2. Applet tags (if applicable)
  3. -D flags (appear in System.properties)
  4. BC4J.properties file in current working directory of Java VM
  5. /oracle/jbo/BC4J.properties resource in the runtime class path
  6. /oracle/jbo/server/jboserver.properties resource (by default found inside bc4jmt.jar)
  7. /oracle/jbo/common/Diagnostic.properties resource (by default found inside bc4jmt.jar)
  8. System defined default as a fallback.

Due to this layered scheme, since jbo.viewlink.consistent will be omitted from the bc4j.xcfg file when it has its default value of 'DEFAULT' -- and thus won't be part of the "client environment" hashtable at application module instantiation time -- BC4J will find the  jbo.viewlink.consistent property in the jboserver.properties file inside bc4jmt.jar and so it will take on the value of false. This was done to guarantee that 9.0.3.X clients upgrading to 9.0.3.3 did not undergo a change in runtime behavior in this regard by simply upgrading.

So, to make sure that you really get the new 9.0.3.3/9.0.4 default view-link consistent behavior for single-updateable-entity view objects, you need to do one of the following (they all will have the same effect):

  1. Add the -Djbo.viewlink.consistent=DEFAULT to your Java VM command line
     
  2. Add an /oracle/jbo/BC4J.properties file to the runtime class path containing a line that reads:
    jbo.viewlink.consistent = DEFAULT
  3. Extract oracle/jbo/server/jboserver.properties file from bc4jmt.jar, update it to comment out the line:
    jbo.viewlink.consistent = false
    and use 'jar uvf' to update the bc4jmt.jar archive file with the modified jboserver.properties file (with the appropriate oracle/jbo/server directory structure preserved in the archive!)

1:28:09 PM    



© Copyright 2006 Steve Muench.