xpratikpatel wrote:
Is it possible to apply validators dynamically?
For example, for an Employee Class(name, dept, salary), when an object is about to save, I want to check if
- Employee with same name does not exist in database
- Department already exist in database
- and some other validations
That sounds like standard Bean Validation. Where is the dynamic part?
xpratikpatel wrote:
I cab create Constraints and Validator classes and store Fully Qualified Names to DB, load them using reflection APIs at runtime. How can I apply these Constraints and Validators to the POJO classes(Employee class in this case)? Is there a way to set Constraints to the POJO classes dynamically?
Can you clarify this? I have no idea what you are talking about? Are you trying to validate proxies? Some code might help as well
--Hardy