MAR
24
2005
Printer Friendly Version
By Glen Smith at Thu, 24 Mar 2005 15:11

I've been playing around with Perisistence frameworks lately, after been inspired by a Hibernate presento at our local JUG. After messing around with Hibernate config issues for ages, I decided to scout around for a lighter weight alternative for my little app and had my first experience with iBatis SQL Maps. All I can say is... Wow!

I've played around with Hibernate before, and it is power unlimited. But rather than getting lost in the Hibernate magic for a little lightweight app I'm working on, I thought I'd shoot for something a little less complicated. Enter SQL Maps...

What I love about this product is that:

  1. it's only a coupla jars;
  2. it's simple to see what is going on, and tune your SQL statements accordingly;
  3. your code gets all the semantic goodness/cleanness of an O/R solution; and
  4. there is very little magic.
Essentially, it's a very lightweight persistence solution that gives you most of the semantics of an O/R Mapping toolkit, without all the drama.

The general gist is that you develop up a little bit of XML sauce to handle the actual query marshalling, ala:


   

Then you call the library with something like...

   List allMsgs = sqlMap.queryForList("getAllMessageDTO",null);
and get back a list of populated objects. Admittedly not quiet as elegant as Hibernate, as the list isn't live, but cool none the less.

You can, of course, put #property# type tags in the SQL which will map to an introspected Javabean property of the object you pass in, so it's very simple to do all standard db select/insert/update/delete goodness.

The doco is very solid, with tutorial/reference/developer PDFs all in good form. As a lightweight persistence library, where Hibernate would be overkill, but where JDBC is just clunky, this library has really found a sweet spot. I'm sold. Very good stuff.

Add Comment

User Id:
Password:
Remember Me:
Download the complete source code to Gravl. Contribute patches and enhancements!
Powered By Grails
Gravl 0.6.3 on Grails 1.2.3 by Glen Smith.