Thursday, February 14, 2013

Oracle Coherence Integration and ADF BC Programmatic VO

Based on blog reader request for my previous post - Data Access Optimization in ADF with Oracle Coherence, I will describe sample application where Oracle Coherence caching functionality is integrated directly into ADF BC. This gives couple of benefits - single Model structure implementation with ADF BC for Coherence based data sources and non Coherence. ADF BC Data Control runtime performance is better comparing to POJO Data Control.

Here you can download sample application - ADFCoherenceApp_v2.zip. Application implements Employee serializable class optimized for Coherence caching - based on Coherence PortableObject:


This class is supported with Coherence POF for optimized serialization:


Sample application contains POF configuration for Employees class:


Main configuration file for Coherence contains reference related to POF configuration:


Coherence cache is constructed only one time per all user sessions from ADF BC AM prepareSession() method. This method is invoked by ADF BC framework automatically, during AM preparation and before any data is shown on UI - perfect place to populate Coherence cache:


Data from Coherence cache is displayed on ADF Faces UI through programmatic ADF BC VO. See another sample for ADF BC programmatic VO here - Fusion Middleware 11g Security - Retrieve Security Groups from ADF 11g. Rows for this programmatic VO are populated from Coherence cache, already initialized in overriden prepareSession() method:


Every attribute for each row is populated from the cache:


Application is started - Coherence cache is populated during AM initialization:


Data is loaded on ADF Faces UI from Coherence cache through programmatic ADF BC VO:


9 comments:

Dave Felcey said...

Hi Andrejus,

A very interesting post.

Dave

Andrej Baranovskij said...

Thanks Dave.

I already did JMeter performance test and will post results in the next blog. VO based on Coherence cache performs faster than regular SQL based VO, as expected.

Andrejus

Anonymous said...

Hi Andrejus,
Very useful post indeed! But, I am wondering how it will work with WLS/ADF 12c. Coherence 12c is built-in and is initialized when Weblogic comes up, so will your POF configuration and serializable classes get picked up from web application?

Thanks,
Prasad

Andrej Baranovskij said...

Hi,

I'm also wondering about it..., would be interesting to test.

Regards,
Andrejus

agtl said...

Hi Andrejus,

May I ask why didn't you cache a List instead? I am just wondering because in my case, MyObject implements Portable and MyObject's only attribute is a List. So I am using something like:

@Override
public void readExternal(PofReader pofReader) throws IOException {
this.otherObjectList = (ArrayList) pofReader.readCollection(0, new ArrayList());
}

@Override
public void writeExternal(PofWriter pofWriter) throws IOException {
pofWriter.writeCollection(0, this.otherObjectList);
}

But I am getting intermittently unknown user type: oracle.jbo.domain.Date and wonder if I need to instead cache each element as you did.

Regards

Unknown said...

agtl,
It might get difficult to update List if you store it in cache. As you need to get whole list out of cache then add/remove/update an element and put it back. Unless that updating is not a problem cache accepts any type of object.

Anonymous said...

Hi Andrejus!
How can I get the file example ADFCoherenceApp_v2.zip?
When you click on the link I get a 404 error :(

Andrej Baranovskij said...

You can download all old examples from here - https://code.google.com/archive/p/jdevsamples/downloads Search by date and download.

Anonymous said...

Thank you!