ColdFusion has always focused on making difficult things easy, and with the new features and tools announced for its public beta on July 13, 2009, Adobe seems set to deliver on that goal in a variety of different ways. Keep reading for a close look at how this beta will help simplify the lives of ColdFusion programmers.
The next version of ColdFusion will include new language enhancements and features, such as Hibernate integration, as well as a new full-featured IDE named ColdFusion Builder. This article will take a closer look at what we have learned so far about the features delivered in the beta version of ColdFusion 9 and Coldfusion Builder, and why they may represent a dramatic shift for the language.
Object Relational Mapping
As object-oriented application development has become the de facto standard in the CFML community, object relational mapping solutions have gained prominence. Object relational mapping (ORM) not only allows you to easily persist objects within a relational database without writing SQL, but it allows your application to easily support multiple database systems with a single codebase. Currently this is supported via third-party libraries such as the open source Transfer ORM.
Let's look at a simple example. The component below represents a simple user object (user.cfc) that will persist automatically to the database in the "users" table. It is composed of a userType object that is also automatically persisted to the database, with the relationship maintained by Hibernate when the user object is retrieved from the database.
The code above also uses the implicit getters and setters, a new feature in ColdFusion 9, as becomes obvious when you look at an example of how to persist this object. The code below will create and populate the object with some sample data. The example below wraps basic CRUD and query methods. The code references userService which, for the sake of brevity, is not included here.