Saturday, November 12, 2011

prepareModel, renderModel and the lifeCycle. ADF 11g

This is a small post explaining a bit the difference of prepareModel and renderModel options in the refresh property of an InvokeAction.

Those two refresh properties are very self explanatory..

The only difference is the following:

prepareModel: Is executed right after initContext is executed.

renderModel: Is executed right after metadataCommit is executed.

In other words, prepareModel is executed right before any validations or posts or updates take place. Basically, is executed after initContext and before everything else. So, this property is useful for actions and methods that do not require any validation process or updates. It will be executed before all that.

RenderModel, on the other hand, is executed after all those steps are done and passed. So we can use this refresh option when our business logic, or our logic, claims that all steps of the life Cycle should be done.

I understand that this is not the full description nor it is the official documentation. Besides, there is the official documentation for that. But, those lines can be used in everyday developing and I believe that can help in understanding which property we should choose depending on the case.