Sunday, October 9, 2011

Rollback After Validation Error Entity Level. ADF 11g

There has been a discussion in the OTN forum regarding how to rollback when an Entity validation error appears..
Well, at first, I thought we could use the refresh(int refMode) method inside a validation method which will reside in EntityImpl java class. This thing is that this approach does not seem to work properly... at least for me.. Or maybe, according to documentation, I cannot place the correct combination of refresh MOdes.. If anyone has a successful example, please

The case is rather simple.
We have a validation rule for an attribute. If this validation fails, we have to rollback.
Well, of course the validation rule will be applied in the BC and more specifically in the entity. Since we want to have an additional logic after the validation, we will create a validation method through the wizard.
So, after our validation method, we will rollback, calling the DBTransaction rollback;


This example will always rollback. It is just an example.

After setting up successfully the validation method to the DepartmentName attribute in the EntityImpl java class, all we have to do is to drag and drop the Departments Iterator in our jspx as a af:table. Last thing is to have the DepartmentName autosubmit=true.
And that's it, it will refresh the value from the db.

Download the Sample application:


No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...