Vgo Software

Entries in Release 2 (1)

Tuesday
Jun122012

ADF Release 2 - Problem Clearing Cache Resolved

I found this exception after upgrading to Release 2 of ADF with an application that was previously working in Release 1.

This application is based on a previously exisitng forms application and as such, it depends upon a lot of stored procedures and even a lot of database triggers.  We had a situation where, when creating a new record, database triggers in the database created a bunch of rows in other tables, those records then needed to be displayed on an edit screen for the newly created object.  Once the Entities and ADF View Objects were all set up it all works smoothly if we could get the newly created records from the DB.  In order for that to work, the application was calling this.getDBTransaction().clearEntityCache(null) in the application module.

The clearEntityCache(String arg) method is supposed to clear the cache for the object with the given name or all of the cache if the passed in argument is null.  In Release 2 of ADF this was causing an exception to be thrown.  The exception was a NullPointerException in the sendOrQueueEventForSharedTrans method of DBTransactionImpl.

The fix that was implemented was to change the code to this.getDBTransaction().setClearCacheOnCommit(true); before the commit was performed and remove the clearEntityCache(null) call that coming after the commit.