ORM Sample Blog Updated to CF9.01
When ColdFusion 9 was first launched (a year ago), I wrote a port of Mark Mandel's tBlog which used Hibernate instead of Transfer. Now that ColdFusion 9.01 has been released I thought it was time to update the code.
The main thing that has changed is the use of transactions. In ColdFusion 9, ORM transactions were pretty much useless as ColdFusion would flush and close any existing ORM sessions, and create a new ORM session each time a transaction began. This behaviour has been modified in ColdFusion 9.01, now that transactions work "as expected", I've disabled the automanageSession and flushatrequest end ormsettings as I want to control this myself. Bob Silverberg has a great expanation on his blog about the improvements to session management. As a result of using transactions I can remove the ORMFlush() calls I was using.
Other CF9.01 features are the use of "for in" loops. So instead of having to write this:
for( counter = 1; counter <= ArrayLen(IDComments); counter++ )
{
item = IDComments[ counter ];
// do something
}
I can now use this:
for( item in IDComments ) {
// do something
}
Finally, I don't know how to admit this, but there was a bug in my original code which is now fixed!
You can download it here:
- Posted in:
- ColdFusion
- Hibernate


Comment by Reinhard Jung – October 19, 2010