Refreshing a ViewObject on view in JHeadstart javacode 9085791

Refreshing a ViewObject on view in JHeadstart

Imagine this situation: you have created several tables and a view that queries several columns in these tables. Using BC4J you’d create a ViewObject on the view. The ViewObject contains all the data retrieved from the view, but it won’t show the most recent data if one (or more) of the columns in the tables are updated, i.e. if the output of the view is modified.
On the Oracle Technology Networks Forum I found this solution which I needed to modify a little bit since my view depends on more than one table. Instead of executing the view query when committing changes to a table, I would like to execute the query when the data in the view is displayed.

Of course I could use the provided solution and implement it for each and every ViewObject for the tables that are queried by the view. But when a table is removed from the view, or one is added, I would have to update the implemented changes for those tables. Rather I would have one solution that only needs to be implemented once.
Following the provided solution at OTN, I first modified the Impl java source for my application module. I added this code

public void doQuery() {

Next I published this method through the Client Interface of the Application Module. So far, nothing differs from the solution as provided at OTN.
However, in order to be able to execute the update when loading the ViewObject data in a web page, I need to call the doQuery() method in my application module in the prepareModel method of the JhsDataAction. So, I extended the JhsDataAction class and put this code into it:

public void prepareModel(DataActionContext daContext) throws Exception {
  // before preparing the data model, requery the mailinglist rows
  // Override of oracle.jheadstart.controller.strutsadf.action.JhsDataAction method

and everything is working as I want now.


  1. Wouter van Reeven May 9, 2005
  2. Thim May 9, 2005
  3. Leon van Tegelen April 1, 2005