Chapter 6 - Code Snippets Add Data Validation Code: Phase I - Add a Validation Check on the Salary Column Using Java p. 183-184 To add the error handling class, locate the import statments and add import oracle.jbo.JboException; Locate setSal() method and modify it to look like the following code: /** * Sets value as the attribute value for Sal */ public void setSal(Number value) { if (value.floatValue() < 500){ throw new JboException("Salary below minimum"); } setAttributeInternal(SAL, value); } --------------------------------------------------------------- Add Data Validation Code: Phase II - Create Attribute Validation at the Row Level p. 184-185 To add an error handling class, locate the import statements and add the following code: import oracle.jbo.JboException; Add the following code just above the getGrade() method. You may implement either block of code. public void validateEntity() { //Generated call super.validateEntity(); //Custom validation is added here using special Jbo Boolean checks //Rule: Losal is greater than Hisal - throw exception if (this.getLosal().compareTo(this.getHisal()) > 0 ){ throw new JboException("Losal greater than Hisal."); } } or public void validateEntity() { //Generated call super.validateEntity(); //Custom validation is added here using type conversion //Rule: Losal is greater than Hisal - throw exception if (this.getLosal().shortValue() > this.getHisal().shortValue()){ throw new JboException("Losal greater than Hisal."); } } ----------------------------------------------------------------------