Larry, thanks for the comparison! The possibilty to use dialect specific sql code with different SQL mappings seems to be most striking to me :)
Oliver On Mon, 29 Nov 2004 17:07:16 -0700, Larry Meadors <[EMAIL PROTECTED]> wrote: > >>> [EMAIL PROTECTED] 11/29/04 2:53 PM >>> > > I see, what is the benefit over using pure SQL, JDBC or something like > > http://jakarta.apache.org/commons/dbutils/index.html then? > > I have not used dbUtils, but I just took a quick look at the examples > page: > - http://jakarta.apache.org/commons/dbutils/examples.html > > Here are some major differences I see: > > - The amount of code you have to write is much smaller with iBATIS. For > example, the ResultSetHandler class that is shown on the dbUtils page is > really always done for you in the sql maps. > > - The sql in the first example there is also extracted from your java > code. Which would you rather read: > > <mapped-statement name="getUnit" result-class="java.util.HashMap" > cache-model="five-minute"> > select > unt as "unit", > dsc as "description" > from > RMUnt > where > unt = #unit# > </mapped-statement> > > - or - > > String mySQL = "select unt as \"unit\", " > + "dsc as \"description\" " > + "from RMUnt " > + "where unt = ?"; > > (...add more code here to move the columns into a map entries, deal with > caching, deal with empty resultsets, SQL exceptions and so on...) > > Also, because your sql is external to your java code, you can use > dialect specific sql very easily (by using a properties file to specify > the path to the sql maps). > > Larry > >