Tuesday, February 3, 2009

Simplifying JDBC in DSL fashion

I like these libs, which are way simpler to understand and learn (at least, for simple queries) and much more lightweight than full-blown ORM tools like Hibernate:
  • JaQu, though I can't figure out if it could be downloaded without H2
  • LIQUidFORM, which does its best to look like LINQ
  • And some other LINQ-inspired implementations for Java
To understand what I'm talking about, consider this simple example replacing all that verbose JDBC stuff:
Product p = new Product();
List soldOutProducts =
db.from(p).where(p.unitsInStock).is(0).select();
And yes, I wish you good luck, because I'm afraid, some cool features (closures, etc) which can improve DSL implementation in Java won't be included in JSE 7. That's why I'm looking at Groovy with increasing interest and can't wait to see good IDE support for it.

Update: they actually will include closures in JSE 7! Not looking at Groovy anymore :)

No comments:

Post a Comment