Saturday, March 23, 2013

Execute a ViewObject (VO) query in ApplicationModule (AM)

For example let
  1.  VO name be StockDetailsVO
  2. AM name be StockMarketAM

 If the Java class for the VO is not generated
  • Go to the Java section of the StockDetailsVO and generate the StockDetailsVOImpl.java
  • If you have the Bind Variables, then click the check box Include bind variable accessors
 If the Java class for the AM is not generated
  •  Go to the Java section of the AM and generate the StockMarketAMImpl.java
Use the following code snippet

    public void executeViewObject() {
       StockDetailsVOImpl vo = getStockDetailsVO();
       vo.executeQuery();
   }

If you want to set some Bind Variable value before executing the VO, use the following code

    public void executeViewObject(int portfolioID) {
       StockDetailsVOImpl vo = getStockDetailsVO();
       vo.setBindPortfolioID(portfolioID);
       vo.executeQuery();
    }

No comments:

Post a Comment