Using getPostedAttribute() to determine the posted attribute's value
There are times when you need to get the original database value of an entity object atttribute, such as when you want to compare the attribute's current value to the original database value. In this recipe, we will illustrate how to do this by utilizing the getPostedAttribute()
method.
Getting ready
We will be working on the SharedComponets
workspace. We will add a helper method to the custom entity framework class.
How to do it...
1. Start by opening the
SharedComponets
workspace. If needed, follow the steps in the referenced recipe to create it.2. Locate the custom entity framework class and open it into the source editor.
3. Add the following code to the custom entity framework class:
/** * Check if attribute's value differs from its posted value * @param attrIdx the attribute index * @return */ public boolean isAttrValueChanged(int attrIdx) { // get the attribute's posted value Object postedValue = getPostedAttribute(attrIdx...