iBATIS

Using JDBC directly can get tedious fast, particularly when the database schema is in flux.  Many Java developers use Hibernate, but I prefer to work closer to the metal.  If you are like me, you should take a look at iBATIS (I, Bad Ass?).

Below is an example of iBATIS SQL mapping definition:

<select id="getAddress" parameterClass="int" 
        resultClass="examples.domain.Address">

      select
        ADR_ID           as id,
        ADR_DESCRIPTION  as description,
        ADR_STREET       as street,
        ADR_CITY         as city,
        ADR_PROVINCE     as province,
        ADR_POSTAL_CODE  as postalCode
      from ADDRESS
      where ADR_ID = #value#
</select>

And here is the Java code that uses it to fetch an address:

Integer pk = new Integer(5);
Address address = (Address)
    sqlMap.queryForObject("getAddress", pk);

Simple and intuitive yet flexible enough to get us into trouble.  What more can you ask for?

BTW, iBATIS for .NET was released earlier this month