[Looking for Charlie's main web site?]

Spying on ORM database interactions: Hibernate, Transfer, etc. on any CFML engine

Note: This blog post is from 2009. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
As people use CF9's ORM feature (or other ORMs like Transfer and Reactor, or indeed Hibernate, on any version of CF6+ or indeed any other CFML engine), they may be left wondering what sort of SQL interactions happen "under the covers" between the ORM framework and the database engine (whether in a given request, or perhaps at startup of CF).

Well, there are several ways you can watch them, as this entry will discuss, and some may be better suited to the job than others. It can be very interesting to discover what's going on, especially if you're having any suspected performance problems which you think may be related to ORM processing (or just if you wonder what all it does for you).

[....Continue Reading....]

IBATIS as a possible new approach to object-relational mapping for CFML?

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
I'd like to put out for consideration by the CFML community a possible new approach for object-relational mapping (ORM), using an existing Apache project called IBATIS as a model. I'm wondering if someone may want to consider implementing a CFML version of it for a new ORM approach in CFML.

IBATIS, at http://ibatis.apache.org/ is an alternative ORM approach based on a concept of SQL Maps, which in essence are simply SQL statements stored in XML files with a well-defined API for mapping and manipulating those in your app. The approach does not generate SQL for you, but rather is intended to serve as a means to segregate to XML files--and manage via an API--the SQL that may already exist substantially for existing apps or for new apps that may simply require some hand-coding of SQL. (The last sentence added after some comments suggest that this point made later in the post was missed.)

The benefit is that since CFML folks are already knee deep in SQL, it brings a measure of architecture without completely detaching them from the SQL they know and love (or at least tolerate).

If that sounds counter to other ORM approaches, which often generate the SQL automatically and/or intentionally hide it from you, that's because it is quite different. I'll grant that there are many who would benefit from having an architecture remove SQL from their control. It's just that this seems an alternative worth considering.

I certainly don't mean to knock at all the other CFML-based ORM implementations that exist already (such as Arf, ObjectBreeze, Transfer, and Reactor). Each approach has its place and pros/cons. As the other CFML-based ORM frameworks tend to be based on existing approaches from other platforms, I'm merely pointing out this alternative as a possibly useful model.

I'm also not offering here my own new CFML-based implementation based on IBATIS. But note that there are currently implementations for Java and .NET at the Apache site, so it shouldn't be tough for someone to leverage the Java implementation in CFML.

It strikes me that the IBATIS approach may be closer to the way fuseboxers and others segregate their queries into their own CFML file. Perhaps this approach of storing them in an XML file instead and using an API to access the results would offer a better though still somewhat familiar approach to abstracting queries.

I was sharing the idea with Sean Corfield at CFUnited last night, and he was intrigued. After I sat in on his excellent presentation on objects and persistence, we discussed it again and he had started looking into it overnight. Perhaps it could make it into FB 6? :-)

I'm hoping someone may want to take the ball and run with it. If you're intrigued, considering discussing it with Sean or take it on yourself, or just continue the conversation. Hope it proves helpful.

Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting