Thursday, March 15, 2012

Use Case for ADF BC With No Database Connection

There is very good sample application from Steve Muench - #147 ADFBC Application With No Database Connection (not yet documented). I was using it to implement recent request from the project, its why I would like to document it. We had a discussion with SOA developers and they were wondering if its possible to run ADF BC application, without DB access. This is quite common use case in SOA projects, there is no direct access to DB and we need to consume data through Web Service layer, as for example. Yes its possible and I see quite strong advantage of ADF BC, even when working with non DB data sources - its easy to centralize data access through programmatic VO's, its fast to expose programmatic VO through Data Control and finally is easy to capture user data input, use out of the box functions to process user data (getting current row from VO, iterating over row set, creating new rows, deleting rows, etc.). This can be as alternative for Web Service Data Control.

Sample application - use case is described in this diagram:

ADF BC application is disabled from creating database connection, instead it contains programmatic VO to retrieve data from alternate data source.

I would recommend to check Steve Muench sample #147 (see link above), for this use case I took original code and migrated it to JDev 11g R2:

If you want to disable database access for ADF BC application, you will need to update bc4j.xcfg with proper entries. I would recommend to update this file from outside, not from JDeveloper - otherwise you may experience errors - seems like JDeveloper IDE is constantly scanning changes from bc4j.xcfg. Make sure to update bc4j.xcfg as from sample application, for example RequiresConnection=false and other settings:

Default Connection Strategy is extended to disable database connection:

Application Pool is disabled to perform passivation:

Handle Commit and Handle Rollback methods are disabled:

We are done with extending framework. Now I can describe simple use case - programmatic VO to retrieve user roles from WebLogic security provider (based on my previous post). Programmatic VO is reading data from WebLogic security provider:

View Object doesn't have any SQL statement, obviously it retrieves data from non database source:

When building ViewController, we can use regular Data Control - same as we would have from standard ADF BC:

Data is rendered successfully on ADF UI:

In this case, application runs independently of database and we still can use all powerful ADF BC data processing features.


kkchopra said...

Awesome....Thanks for sharing this

Rajdeep Chaudhary said...

How can we add viewcriteria to such programmaticVO ?
Any directions ?

Valon Sejdini said...

Thanks for the great share.

Does this support pagination on af:table scroll ?



Andrejus Baranovskis said...

Nope. Pagination is coming with the new ADF release.


Srikanth Irukulla said...

Hi Andrejus,

You are very right in mentioning that in a SOA landscape, clients expect the applications (ADF-BC in this case) to be based on Webservices, and all the CRUD operations happen through services and zero db connectivity.

In such case, I see that most of the performance tuning to be done at the web service layer, as BC4J gets very much light-weight with not Connection/data source worries.

From your experience, Could you pls suggest what performance measures to be taken from ADF (Binding + BC4J layers) perspective?


Jaime said...

Hi Andrejus,

Does this implementation supports Query? I mean like ADF Query component, where you could search some fields and display it in the table. I know this can be done using EBJ or with usual data binding(with database). Just looking for your approach if this can be done, as I found it the most easiest in my case/requirements.

Hoping for your reply.

Thanks in advance!

Andrejus Baranovskis said...

This should be possible, you could define View Criteria and catch parameter in executeQuery method in View Impl class.


Don Kleppinger said...

Can Sample be ported to I get deployment error.
weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "weblogic.j2ee.descriptor.wl.SecurityRoleAssignmentBeanImpl@57d2982a(/SecurityRoleAssignments[valid-users])"

Andrejus Baranovskis said...

It could be, JDEV corrupts ADF config files. I assume it should work, but I don't have version installed anymore to test.


Mounika Mouni said...

Hi, i have tried this application in jdeveloper version and but its not in which version this applicatio works?

Andrejus Baranovskis said...

It was implemented with, but you could implement the same functionality with any ADF version, it will work.


Haripriya Mn said...

Hi Andrejus,

Can we have one more Application Module with Data source connection provided, and fetching the data from local DB, displaying it in same UI page, i.e., just below the roles table.

I have a scenario, where some data of page is displayed with DB connection less AM and some page data using Data Source connection in AM. I am facing issue in rendering data in this case.

Kindly help.

Hari Priya MN


Hi andrejus

Can I have example in jdev 12.1.3

I tried it is not working

Andrejus Baranovskis said...

Ok, I didnt had chance to test it yet with 12.1.3


Gokul Gopinathan said...

Hi Andrejus,

Great post!!

If we remove the connections then how the PS_TXN information is managed?
Can we store the information in File system?


Andrejus Baranovskis said...

You can tune AM pool to avoid passivations/activations. PS_TXN will not be needed in such case.


Ganesh Babu said...

Does this work on clustered on environment ? I have the same use case and i have implemented as per this approach and it works absolutely fine without any issues.Wanna know whether this works on clustered on environment ?