First page Back Continue Last page Graphics

Using Programmatic Validation


Using Programmatic Validation

You can also implement validation logic in a nondeclarative manner adding a method to an entity object and then explicitly calling it as part of the validation cycle. You can accomplish this by adding a method in the file. Because the method is not called automatically by the framework, call it from the validateEntity() method. The validateEntity() method is called at commit time when any attribute has been updated.

To create the validateEntity() method if it does not exist, perform the following steps:

1. Select Source > Override Methods from the source code editor of the <EO_Name> class.

2. Select validateEntity() to override.

3. Add code to call the custom method:

protected void validateEntity() {

if (!checkOrderMode()) {

throw new JboException("Online order must have email");