4 Replies Latest reply: May 21, 2013 11:41 AM by CInglez RSS

    Load VO as a "Cursor"

      Hello all.

      I want to use the ADF Business Components to read some tables in my application, and then execute some code. I do not need a ViewController project, because this app does not have any pages, it just runs some code from time to time, updating some table columns.

      I have already created all View Objects, but I have never executed them programmatically, I have only executed it using a ViewCotroller project. What I need:

      Execute a View Object, loading the lines as if it was a PLSQL cursor. Execute some code. Update some Entity values. Commit.

      Could you please give some advice on how to do it? Any examples would be appreciated.

      Thanks in advance.
        • 1. Re: Load VO as a "Cursor"
          Zeeshan BaiG

          Check this http://docs.oracle.com/cd/E28280_01/web.1111/b31974/bcqueryresults.htm#sm0094

          • 2. Re: Load VO as a "Cursor"
            Hi, it is exactly what I need, but I cannot make the changes to the record. An example:

            public static void main(String[] args) throws RemoteException, XMLStreamException {

            String amDef = "cte.model.am.AppModule";
            String config = "AppModuleLocal";
            ApplicationModule amInut = Configuration.createRootApplicationModule(amDef, config);
            ViewObject voInut = amInut.findViewObject("CteInutilizacoesView1");



            while (voInut.hasNext()) {
            Row inutiliza = voInut.next();
            String xmlAssinado = inutiliza.getAttribute("XmlAssinado").toString();

            inutiliza.setAttribute("CteEmpresa", 1);
            inutiliza.setAttribute("CteLocal", 2);


            cteInutilizacaoSPHOM inutSP = new cteInutilizacaoSPHOM();

            Configuration.releaseRootApplicationModule(amInut, true);

            When I try to commit the transaction (amInut.getTransaction().commit();), I get:

            Exception in thread "main" oracle.jbo.RowInconsistentException: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[21 ].

            What could I be missing?

            Thanks in advance.

            Edited by: CInglez on May 21, 2013 5:02 AM
            • 3. Re: Load VO as a "Cursor"
              How could I access methods specified in AppModuleImpl inside the scheleton? Is there another way to executa plsql code?

              • 4. Re: Load VO as a "Cursor"
                It's ok, it's working now. Thanks!