a really solid, perhaps unique, library that, as far as i can tell, completely addresses the "impedence mismatch" argument. if you're directly using a database api in a structured way, you've probably already reimplemented the sqlalchemy core, and refactoring your program to use sqlalchemy will give you an orm, should you want one, and make your code portable across database implementations even if you don't. if you're already using an orm, refactoring to use sqlalchemy will allow you to to start optimizing the low-level database operations in a coherent way (i.e. not just sprinkling SQL throughout the models). there's a nice writeup in the architecture of open source applications ( http://www.aosabook.org/en/sqlalchemy.html )
now, fantods aside, is there anything like this for java? according to the aosa writeup, sqlalchemy's author found python's multiple inheritance useful for implementing certain ideas, so porting probably isn't straightforward. also, the relevant stackoverflow question ( http://stackoverflow.com/questions/10537766/closest-equivale... ) seems inconclusive.
this is not to criticize java as a language, but rather because i really wish there was something like sqlalchemy for java.
It's very similar to a "Hibernate for Python", and I believe it started out that way. However, it has since surpassed Hibernate in capabilities, and presents elegant APIs that cover a more substantial fraction of "things you'd want to do in SQL".
You could also check out Crudzilla (crudzilla.com), it has a middleware that simply allows you to specify your SQL and forget about everything else. Includes a bunch of other goodies that'll make web development a pleasure :)