Friday, July 27, 2012

LOV Implementation with ADF BC Service-Enabled Entity Objects

I had a question about use case related to ADF architecture for different databases access. ADF system was running on multiple databases (Oracle, Microsoft SQL Server, IBM DB2) at once. Part of the data was coming from Oracle DB, LOV's data from Microsoft SQL Server, the rest from IBM DB2. ADF BC 11g connects to all three databases and can work without issues. However, from architecture point of view - ADF BC Model project is configured with database type, means ADF BC Model can connect to only one DB type. If we want to connect to other DB type, need to have separate ADF BC Model project. No problem with that - only one question. How we can integrate all these projects with different DB types together. One of the possible solutions for this scenario I will describe in today post -  ADF BC Service-Enabled Entity Objects. I have blogged about it back in 2009, always nice to revisit same topic after couple of years - Web Service Interface for ADF BC Application Module in Oracle Fusion 11g and Service-Enabled Entity Objects in Oracle Fusion 11g.

Download sample application, it incudes both - LOV service and consuming application - The idea is pretty simple - LOV service and consuming application both are implemented with ADF BC. You can imagine that LOV service works with Microsoft SQL Server and  consuming application connects to Oracle DB (in this sample, both connect to Oracle DB). LOV Service is exposing View Object through Web Service. Exposed View Object is accessed in consuming application through Service-Enabled Entity.

LOV service defines LOV view object, this view object is registered under service interface. At least one operation must be defined to expose view object through the service interface - Find in my case:

Business Components Service Interface must be defined in deployment profiles - this allows to deploy Service-Enabled entities successfully:

Make sure only MiddleTier is selected for deployment from Application Deployment profile assembly:

Thats all about LOV service, now we go to consuming application. Here we can generate EO's based on view object exposed through LOV Web Service. Create EO based on Service Interface:

In order to run project with EO based on Service Interface, you will need to add common JAR from LOV service (add it to Model project as well, if you want to run ADF BC browser utility):

Define Web Service connection information in connection.xml file:

Next you can create VO from generated EO - create it as read-only (in other scenarios you can use updateable VO as well), because it will render read-only LOV data:

I noticed interesting custom property generated for VO created based on service interface EO - DeferEstimatedRowCountProperty. I will test this, how it affects standard VO in future posts. From Oracle API - "A custom property name that indicates if this VO should defer calling estimatedRowCount in the 'getDeferredEstimatedRowCount' method.". Here is custom property:

Define LOV in usual way for JobId attribute - LOV list will come from Web Service:

Choice list LOV is rendered on runtime:

LOV list data is retrieved from Web Service - Service-Enabled Entity:

No comments: