FROM THE BLOG

ADF Tips: Timestamp when updating a row based on Business Components + Morale!

Last week I participated in a thread where an user asked the following question

“is there a way i can auto populate the updatedtimestamp with system date even though its not present in the UI?”.

Since the main question was about how to update a binding attribute without using the UI I refered the following method (from a JSFUtil):

setELExpression

Which was meant to be called before commiting and passing the current time stamp to the actual  #{bindings.timestampcolumn.inputValue}.

Another user replied with a better way to implement the requirement; modifying the doDML in the Entity Object to actually update the timeStampColumn;

DoDML

When I say ‘better way’ I mean it in the way that writing this once in the DoDML of the EntityImpl class, would mean that the functionality will work without an UI which is desired behaviour in a correct MVC implementation. Anyway, the user marked this last response as the correct one and probably its code will remain unchanged forever.

Although we both gave valid solutions, one better than the other one, it doesn’t mean that the given answers were the ‘correct’ ones.

In JDeveloper 11.1.1.7, for example, and probably older versions as well, if you select a TimeStamp Attribute from your EO, you can tell the framework to update its value with the locale system time stamp every time the row is modified;

historyColumn

Testing this in the Application Module;

am1

Modifying LastName and commiting to DB;

am2

What is the Morale? It is obvious, isn’t? There is a big difference between working along with the framework and making things to work within the framework. Although some people state that one can learn ADF following some tutorials in few months, reality is very far from this. It may take several years of continous exposure to the framework, study, research and willingness to become a better ADF Developer to be able to work flowless along the framework rather than just making things work within it.

Leave a comment

Your email address will not be published.

Social Media

Stay up-to-date with our latest ADF and related technical posts via your favourite social network services.