Overriding attribute validation exceptions
At the ADF-BC layer, built-in validators are stored in the XML metadata definition file with no ability to customize the exception message and/or centralize the application error messages in a single application-wide message bundle file. To overcome this you can extend the oracle.jbo.ValidationException
and oracle.jbo.AttrValException
classes. Then in your custom entity object implementation class you can override the validateEntity()
and setAttributeInternal()
methods to throw these custom exceptions instead. Even better, if you have gone through the process of creating framework extension classes (see Setting up BC base classes, Chapter 1, Pre-requisites to Success: ADF Project Setup and Foundations), this functionality can be added to the base entity object framework extension class and thereby used in a generic way throughout the application.
In this recipe, we will extend the oracle.jbo.AttrValException
class in order to provide a custom...