Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:14:06 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

August 2004
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        
Jul   Sep

Get Firefox!

Wednesday, August 11, 2004

After reading the OTN article How To Support Dynamic JDBC Credentials, several customers have asked whether the same techniques will work outside of a Struts context. The ADF related code to support dynamic credentials is not dependent on Struts, but a tiny bit of the example code referenced a "main.do" in a place that made it only work for Struts. To illustrate that both Model 1 and Model 2 style applications can share the same enabling ADF code that the article explains, I built an example workspace that contains four projects:

  1. FwkExtensions -- generic code for dynamic credentials from the above article
  2. Model -- an appmodule, view object, entity based on Dept
  3. ViewController -- the struts-based example
  4. ViewNoController -- the model one (non-struts) example

Both use the same shared code for the dynamic credentials parts. The JSP pages are only so slightly different.

To see the results, try creating a SCOTT2 user and running the CreateScottTigerTables.sql script in the workspace.

Then update something in the DEPT table so you'll be able to visibly tell when you're seeing the data from the SCOTT2 schema versus the base SCOTT schema.

Then try logging in as scott and scott2 users and see the difference.


11:41:37 AM    



Ralf writes in with a question:

Lets say i have two AM's FooAM and BarAM and some service methods in BarAM need to invoke methods of FooAM.

Whats a good approach for this scenario ?

  1. In the service method of BarAM, create a root application module for FooAM, invoke the FooAM service method and when we're done remove the FooAM application module
  2. Reference the FooAM application module from BarAM Is there a big performance impact when using 1.?

ADF Business Components supports the ability for BarAM to aggregate an instance of FooAM that it can reuse. You do this on the "Application Modules" panel of the AM Editor for BarAM.

Just like when you include an instance of a view object in an AM and you assign it a member name, you assign a member name to the aggregated AM instance.If you name the nested instance of FooAM something like "FooService", then we will generate you a getter method in the BarAMImpl.java class called getFooService() that returns the FooAM instance.

So, when a method in BarAMImpl.java needs to invoke a method on its nested FooAM instance, it just does:

    public void SomeMethodInBarAM() {
      /* some code here */
      getFooService().someMethodInFooAM();
      /* some other code here. */
    }

You definitely do NOT want to use createRootApplicationModule() in this case.It would create a new transaction/connection as part of a separate top-level root application module.

Using this nested application module feature, the aggegrated application module component's methods are available for easy reuse, as well as its entire "data model" of view object instances. All nested application modules and view object instances contained by a top-level "root" application module instance share a single transaction/database-connection and entity object caches that are "owned" by that root application module.


9:30:20 AM    


© Copyright 2008 Steve Muench.