ORM Model data Validation in ColdFusion 9
As I have blogged about in Part I and Part II data validation is just not where it needs to be yet. I think Adobe has taken a nice stab at it but until some things change your probably going to need to roll your own or use a framework that already exists. Before we look at some potential solutions I want to take a look at some examples from outside of the ColdFusion world.
In the Java world when you use Hibernate there is a built in validation framework called Hibernate Validator. In your model you setup your constraints using annotations. In grails you can setup constraints pretty easily. In python (django) you can setup your constraints when you declare the property.
I hope you are starting to see a pattern here. Your model only needs to do 2 things. First you need to setup your properties and second you need to define some constraints on those properties. With that In mind I started a validation framework that would do just that in ColdFusion 9. I based this project off of Hibernate Validator so sticking with what it does we can just setup our constraints using annotations. I am going to start a whole new series related to this but for now you can check out the project page at http://hyrule.riaforge.org. I hope going forward the engineers find a way to include Hibernate Validator in ColdFusion. That would be one of my enhancement requests but until then you can always check out my project! Thoughts?
