iBatis O/R mapping
After some years of Hibernate or Spring+Hibernate it was time to try something new. Not for the sake of trying something new, but more out of the need.
Think of a legacy database, very generic, without a clear business model representation. As a metadata storage database, different bussiness objects were persisted in the same data structures.
Navigating large datatabase relationships is easily done with Ibatis. The ability to use SQL directly and then map results to objects makes it the right choice for a speedy development. Once the results maps are defined, they can be reused in loading more complex relations like 1-1 or 1-many. For 1-many, everything is done at SQL level, with the specification of a “grouping” parameter, the one that identifies the “1” part.
Mappings separation is done using namespaces, this allows access to definitions in other SQL maps and good separation for larger applications.
Spring SqlMapClientDaoSupport provides simple methods to insert, update, delete but also allows complex querying using various callbacks such as RowHandler or SqlMapClientCallback. A nice touch is “queryForMap” method, that allows to easily load lookup caches or generally have results as Maps.
IBatis is surely the O/R mapping tool to use when the database is legacy and using Hibernate to map objects is not straightforward.