ORM Model data Validation in ColdFusion 9

Word Count: 430

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?

Comments

#1 Posted By: Brian Meloche Posted On: 11/21/09 4:42 PM
Dan, you're humble.

You all should REALLY take a look at Hyrule. It's the bomb. I was VERY impressed. For something that Dan downplays, I must say it's brilliant.
#2 Posted By: Jason Dean Posted On: 11/21/09 6:42 PM
Brian is absolutely right. I think this is absolutely fantastic thing that Dan has put together to make something the is a HUGE pain in the ass much easier.

Hyrule is without a question going to be the next thing I incorporate into new projects.
#3 Posted By: Dan Vega Posted On: 11/21/09 6:59 PM |
Author Comment
Thanks guys! Anyone who uses it in the future or is using it now please let me know your thoughts. I am working some new things for the framework but I really want to get some feedback so I can move it towards a 1.0 release.
#4 Posted By: Lola LB Posted On: 11/21/09 9:04 PM
Umm . . . this framework is going to be usable with other frameworks, like M-G, Coldbox, Coldspring, etc?
#5 Posted By: Daniel Short Posted On: 11/21/09 9:10 PM
Hi Dan,

Will (or does) Hyrule support annotating standard CFCs (those not written in full cfscript)?
#6 Posted By: Kevin Roche Posted On: 11/21/09 9:13 PM
You are so right!

Validation is a big piece missing from many current frameworks. Can wait to try yours out, I really believe that declaring the rules in the metadata is the way to go.
#7 Posted By: Seth Johnson Posted On: 11/22/09 9:24 AM
Looks really promising! Thank you for your effort, this is goin got make life a lot easier. @Daniel, I noticed some tag based examples in the projects so, yes.
#8 Posted By: Dan Vega Posted On: 11/22/09 10:04 AM |
Author Comment
@Lola - This project should really plug into any other framework just fine. With that said I will try and get some examples together.

@Daniel - As Seth said there is a tag based example in the samples folder

@Kevin / Seth - Thank You!
#9 Posted By: Sam Farmer Posted On: 11/22/09 11:27 AM
Dan, way cool. I'm going to try and roll this in to a project I'm working on this week. (Though, its my first Flex project so I don't know how much I want to bite off at one time!)
#10 Posted By: Daniel Short Posted On: 11/23/09 2:41 PM
Thanks for the replies gentlemen. I'll definitely give it a look :-).


Post Your Comment

Leave this field empty







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.