Esquire Theme by Matthew Buchanan
Social icons by Tim van Damme

05

Sep

MyBatis SqlBuilder Rewritten!

MyBatis SqlBuilder is one of the few SQL builders that allows you to generate pretty Pre-Processed SQL. That is SQL that has place holders. 

Now MyBatis SqlBuilder is sort of a joke in that it uses ThreadLocal… seriously ThreadLocal for an extremely simple DSL.  I would expect that from something like Hibernate but a tiny one class DSL. In fact when I first saw it I decided I would probably never use/need it because things like JOOQ and QueryDSL exist.

However I recently implemented my own Immutable ORM and need some simple SQL for Spring JDBC.

Consequently I ported MyBatis SqlBuilder to JATL style. In other words the better way to do this is to use Anonymous classes and/or Fluent style.

My Gist Here: The above Gist might not show because Tumblr sucks. https://gist.github.com/3650165