Forum Stats

  • 3,815,381 Users
  • 2,259,010 Discussions
  • 7,893,063 Comments

Discussions

Oracle ADF Rest - overridden prepareForDML method is not called when there is no change in attribute

In my EOImpl class , I have overridden prepareForDML method to call an external API and based on external API response I have to update an attributes value.

In case of PATCH API call with change in attribute value it works fine , but PATCH API call without any change in attribute's value prepareForDML method is not executed.

Is it possible to call prepareForDML method when there is no change in attribute's value.

Or is there any alternative approach to implement this ?

Tagged:

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,270 Red Diamond

    User, tell us your exact JDev version, please!


    I don't understand why you need to change something if there isn't a change?

    The framework is intelligent in that it doesn't do anything if there was no change.

    What you can do is introduce a dummy attribute that you change all the time. This should trigger the commit cycle.


    Timo

  • dvohra21
    dvohra21 Member Posts: 14,486 Gold Crown

    What is the sequence used in the EOImpl class? Is the following sequence accurate?

    1. Call the prepareForDML method
    2. Within the prepareForDML method call an external API, as example the PATCH API
    3. Receive the external API response
    4. Conditionally update an attribute

    If this is not the sequence, what is?

    If the sequence listed is accurate, seems like that because no attribute is updated based on API response, it appears as if the prepareForDML method is not called. Add a System.out.println("prepareForDML method called"); statement in the prepareForDML method to verify if it is called. Guess is that it is called.