Databases Reference
In-Depth Information
We will break this acion into the following three parts:
Adding a declaraive validaion : In this case, the number of employees added to the
department should be greater than five
Specifying the execuion rule : In our case, the execuion of this validaion should be
fired only for department number 10
Displaying the error message : We have to show an error message to the user staing
that the number of employees added to the department is less than five
Adding the validation
Following are the steps to add the validaion:
1. Go to the Business Rules secion of DeptEO.xml . You will find the Business Rules
secion in the Overview tab.
2. Select Enity Validators and click on the + buton. You may right-click on the Enity
Validators folder and then select New Validator to add a validator.
3. Select Collection as Rule Type and move on to the Rule Deiniion tab.
4. In this secion, select Count for the Operaion field; Accessor is the associaion
accessor that gets added through a composiion associaion relaionship. Only the
composiion associaion accessor will be listed in the Accessor drop-down menu.
Select the accessor for EmpEO listed in the dropdown, with Empno as the value
for Atribute .
In order to create a composition association accessor, you will
have to create an association between DeptEO.xml and
EmpEO.xml based on the Deptno attribute with cardinality
of 1 to * . The Composition Association option has
to be selected to enable a composition relationship between
the two entities.
5. The value of the Operator opion should be selected as Greater Than . Compare
with will be a literal value, which is 5 that can be entered in the Enter Literal Value
secion below.
Specifying the execution rule
Following are the steps to specify the execuion:
1. Now to set the execuion rule, we will move to the Validaion Execuion tab.
2.
In the Condiional Execuion secion, add Deptno = '10' as the value for
Condiional Execuion Expression .
 
Search WWH ::




Custom Search