5 Replies Latest reply on Feb 10, 2013 10:14 PM by Jeet_A

    ADF doDML not getting called


      I am on Jdeveloper
      We had tables with scenario A(Master) ---->Child(B)Master -->Child C We created Associations and View Links.
      For Table C I put primary key Id in doDML , It was working fine. However we got new requirement where we dont want B. So modified tables to make

      A(Master) --> Child C

      Removed Association,ViewLinks ,from AM, Dropped Constraints.

      However now For table CEOImpl it is callling create method however not calling doDML.

      I tried many options and combinations not worked. Last option I could see is drop and re create EO and associations.

      Let mw know if anyone encountered similar error and fix. Appreciate help.

        • 1. Re: ADF doDML not getting called
          Frank Nimphius-Oracle

          doDML is only called when an entity is updated. This is not the case when the row is created

          1 person found this helpful
          • 2. Re: ADF doDML not getting called
            Correct Frank.

            However first we are creating the row with CreateInsert operation on Button. For specific requirement we are not putting sequence generation in Create Method.
            And then while inserting into Database we were using

                protected void doDML(int operation, TransactionEvent e) {
                    if (operation == DML_INSERT) {
                        SequenceImpl sequence = new SequenceImpl("XX_TABLE_S", getDBTransaction());   
                        BigDecimal pkID  = new BigDecimal(sequence.getSequenceNumber().toString());
                    super.doDML(operation, e);
            Earlier it was working after changing Associations and View Link only doDML is not firing.

            • 3. Re: ADF doDML not getting called
              Timo Hahn
              Jit, I guess you have some error in the setup of the EO/VO you are using. This kind of error is hard to diagnose, so rebuilding the EO/VO is a valid option.
              One more thing is that you should not use doDML to change an attribute. For this you should use prepareForDML(...)
              EntityImpl::prepareForDML(int operation, TransactionEvent e): As the name suggests, this method is invoked before posting changes to the database which allows subclasses to modify any attributes on this entity before posting changes to the database.
              1 person found this helpful
              • 4. Re: ADF doDML not getting called
                Dimitar Dimitrov
                If you create/insert a row programaticĐ°ly (e.g by invoking the method ViewObjectImpl.createRow() followed by ViewObjectImpl.insertRow(), then the newly created row is added to the VO's RowSet and the post state of the underlying Entity is set to STATUS_NEW. However, if you create/insert a row through the built-in CreateInsert iterator action, the entity's state is set to STATUS_INITIALIZED. It is done within the method oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt() after creating/inserting the row to the RowSet - you can see it yourself by decompiling this class. (When the user enters some field values, they are set to the corresponding entity attributes and the framework automatically changes the state to STATUS_NEW).

                If an entity is in STATUS_NEW, it is added to the list of the entities that will be flushed to the DB at commit (i.e. to the list of the entities that are going to be inserted/updated/deleted).
                If an entity is in STATUS_INITIALIZED, it is not added to this list. Something more - if an entity has been in STATUS_NEW but then its state is changed to STATUS_INITIALIZED, then the entity is removed from the list.

                Have a look at the Javadoc of the Row.setNewRowState() method for a better explanation.

                If you have created/inserted your row through an invocation of the built-in CreateInsert iterator binding action, your Entity would be in STATUS_INITIALIZED (unless you set new values to some of entity attributes after that), so it is not registered with the transaction and validation managers and the entity's doDML() method is not invoked and a new row is not inserted to the DB.

                If this is your case, you can solve the problem by changing the entity's state to STATUS_NEW. You can do that by either setting a new value to some of entity's attributes or by invoking the method Row.setNewRowState(Row.STATUS_NEW). Another way is to create/insert the VO row programaticaly (e.g. using a managed bean method) but not through the built-in CreateInsert action. Alternatively, you can programatically invoke the CreateInsert action in a managed bean method and change the state to STATUS_NEW after that.

                1 person found this helpful
                • 5. Re: ADF doDML not getting called
                  Hi Timo/Dimitar,

                  Thanks for reply. I tried both options looks like EO has been messed up. Planning to drop EO and create new.

                  Thanks and Regards,