Vgo Software

Tuesday
Feb262013

ADF ConcurrentModificationException Issue Resolved

So, as I am sure you are aware, a ConcurrentModificationException will be thrown when one thread is iterating through a list and another thread modifies that list.  We encountered this exception being thrown in an ADF Search page, using the search panel.  With a particular LOV, everytime a user searched after selecting a value from the LOV, the exception would be thrown (and then the results returned).

After much head-scratching, we found that another field had two different LOVs tied to it and some logic to determine which LOV to show.  The attribute with LOV causing the problem was used in the logic, however, it was not set as a dependency.  Once it was set as a dependency the problem was solved!

You live, you learn.

Monday
Nov052012

ADF View Objects with Dynamic Where Clauses

While working on a recent modernization project I came across a scenario in which a View Object used by a page had a different where clause depending on one of the values passed in.  All in all, not too big of a deal, but because the where clause used a number of parameters and the parameters used changed along with the where clause it introduced some complications.  So to save you the trouble I thought I'd write about a couple of them here.

First of all, it is easy enough to to create a method in an Aplication Module implementation class that adjusts the where clause to what you need using the ViewObject.setWhereClause(String whereClause) method.  To set the parameters you need to use the ViewObject.setNamedWhereClauseParam(String paramName, Object paramValue) method.  What I found was that I had to have the parameters set at Bind Variables in the View Object and they must have their required property set to true, otherwise they are not really bind variables.  

What that means is that to execute the query, it must contain all of the bind variables even if they are not being used.  That means putting them in the where clause all the time.  To accomplish this for bind variables that were not used, I just put something like "and :par1 = null" and set the value to null using the above method.

This works fine except that since the bind variables are not in the original query definition another problem was encountered.  As soon as the task flow opened, the first thing it had to do was run the method I defined in the Application Module, unfortunately that did not happen.  Instead the first thing that happened was that the View Object executed and returned an error because the bind variables were not in the query.

Apparently in order for my method to work, I needed a page definition file that allowed my method to access my View Object's iterator.  Because this iterator was in the page definition file, ADF executed the query upfront even though nothing that used it was being called yet.  In order to fix this I set the refresh property of the iterator in the page defintion to "never".  This means that the iterator will not execute unless refresh() or execute() are called programattically on the View Object.  Of course this happens in the Application Module method that sets up the where clause after the where clause has been defined with the parameters in it.

That's it, simple enough once you realize what is happening, but a little frustrating before that light bulb goes on!

Tuesday
Jul242012

NEOS on the news!

My company, NEOS is working on the new Connecticut Justice Information System and WTNH spoke to one of our employees about the system for the news last night!

See the story here:

http://www.wtnh.com/dpp/news/new_haven_cty/5-year-anniversary-of-cheshire-home-invasion#.UA61ybR5FOw

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.

Monday
Feb132012

RMOUG Training Days 2012

I will be co-presenting at RMOUG Training Days with Jigar Parsana on the topic of modernizing Oracle Forms to a Struts 2 / Spring / Hibernate solution.  We will present a case study and a comparison between this "open" framework and Oracle's ADF framework.

If you are going to be at RMOUG Training Days, be sure to come by Room 401 on Thursday, February 16th at 2:45.