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 - ADFBCNoDatabaseWSApp.zip 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.
Sample application - ADFBCNoDatabaseWSApp.zip 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.
17 comments:
Awesome....Thanks for sharing this
How can we add viewcriteria to such programmaticVO ?
Any directions ?
Thanks for the great share.
Does this support pagination on af:table scroll ?
Regards,
Valon
Nope. Pagination is coming with the new ADF release.
Andrejus
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?
Thanks,
Sri
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!
This should be possible, you could define View Criteria and catch parameter in executeQuery method in View Impl class.
Regards,
Andrejus
Can Sample be ported to 11.1.1.4? I get deployment error.
weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "weblogic.j2ee.descriptor.wl.SecurityRoleAssignmentBeanImpl@57d2982a(/SecurityRoleAssignments[valid-users])"
It could be, JDEV corrupts ADF config files. I assume it should work, but I don't have version 11.1.1.4 installed anymore to test.
Regards,
Andrejus
Hi, i have tried this application in jdeveloper version 11.1.1.6.0 and 11.1.2.0.0 but its not supporting...so in which version this applicatio works?
It was implemented with 11.1.2.4, but you could implement the same functionality with any ADF version, it will work.
Andrejus
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.
Thanks,
Hari Priya MN
Hi andrejus
Can I have example in jdev 12.1.3
I tried it is not working
Ok, I didnt had chance to test it yet with 12.1.3
Andrejus
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?
Regards
Gokul
You can tune AM pool to avoid passivations/activations. PS_TXN will not be needed in such case.
Regards,
Andrejus
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 ?
Post a Comment