About the Reviewer
Greg Trasuk is the owner of StratusCom Manufacturing Systems Inc http://stratuscom.com. He specializes in operational performance management systems for repetitive manufacturing using Java, Jini, and J2EE technogies. He is the author of the Harvester Application Container.
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.

iBATIS in Action



Author(s) Clinton Begin, Brandon Goodin, Larry Meadors
Publisher Manning Press
PubDate 2007
Reviewer Greg Trasuk



One Minute Review


Positives
  • Clear, concise writing style
  • Good examples
Negatives
  • Occasionally strays from pure iBATIS topics



Sections

Intent & Audience

iBATIS in Action is a comprehensive guide and tutorial to the iBATIS Data Mapper framework http://ibatis.apache.org/. iBATIS provides a simple way to integrate SQL queries into an application, and turn the results of those queries into objects in the virtual machine. It is an alternative to frameworks like Hibernate http://hibernate.org/ or the Java Persistence API http://java.sun.com/javaee/technologies/persistence.jsp.

Relevance of material

Nearly every application of any consequence includes database-backed storage. While object/relational mapping systems like Hibernate and JPA have become popular in recent years, many developers eventually find difficulty using them, either because of complicated domain models or the challenge of mapping to pre-existing databases. iBATIS provides a more minimalist framework that maps objects to SQL queries under full control of the developer.

Chapter highlights

Chapter 1: The iBATIS Philosophy - outlines different approaches to data persistence in enterprise applications, including stored procedures, inline SQL, dynamic SQL, and Object/Relational Mapping. The authors start by indicating strengths and weaknesses of the different approaches, then explain how iBATIS tries to use the best ideas from each approach. They explain how iBATIS fits into a layered enterprise software design. Finally they explain how iBATIS handles common real-world challenges like database ownership, complex keys, denormalized or overnormalized databases, and skinny data models.

Chapter 2: What is iBATIS? - presents a brief overview of iBATIS, discusses the strengths and weaknesses of the iBATIS approach, describes when and when not to use iBATIS, then discusses the future direction of iBATIS development. The examples provide an excellent illustration of how to setup a basic iBATIS configuration in your application and nicely demonstrate the simplicity of using iBATIS.

Chapter 3: Installing and Configuring iBATIS - does just what the title suggests; provides details on how to download, install and configure iBATIS, including instructions for building the product from source. It describes how to use iBATIS both in a standalone application and a web application.

Chapter 4: Working with Mapped Statements - describes the basics of JavaBeans as iBATIS uses them, and describes the iBATIS API. The chapter introduces select statements, parameter mapping and result mapping (inline and explicit).

Chapter 5: Executing Nonquery Statements - shows how to do inserts and updates with iBATIS, talks about reading back primary keys generated by the database, and shows how to call SQL stored procedures.

Chapter 6: Using Advanced Query Techniques - iBATIS normally uses JavaBeans as its input to queries and output of result sets, but can also use XML documents (useful for instance if running iBATIS inside [Cocoon | http://cocoon.apache.org/]), as described in Chapter 6. Other topics include loading related records, lazy loading, handling the "N+1 selects" problem, mapping inheritance, issuing Data Definition Language (DDL) statements from iBATIS, and handling large data sets.

Chapter 7: Transactions - tells how to control iBATIS' use of transactions. In addition to the iBATIS-specific information, it also includes a nice overview of transactions and how they fit into a multi-tier architecture.

Chapter 8: Dynamic SQL - describes how to dynamically generate a SQL query string in iBATIS.

Chapter 9: Caching - covers cache handling in iBATIS. Again, the chapter includes a decent background on why, when, and when not to use a caching strategy.

Chapter 10: iBATIS Data Access Objects - describes the iBATIS DAO package and how it helps to write data access objects. Probably the weakest chapter; I found myself wondering until near the end what exactly iBATIS brings to the party here.

Chapter 11: Doing More with DAO - talks about using the iBATIS DAO framework to create DAOs that use other mechanisms than iBATIS, for instance, plain JDBC, Spring, LDAP and Hibernate. Also contains an interesting introduction to LDAP.

Chapter 12: Extending iBATIS - describes the pluggable extension mechanisms supplied by iBATIS, so you can override type conversion, transaction management, cache implementation, etc. Most users can skip this chapter, but if you need it, the information is here.

Chapter 13: iBATIS Best Practices - gives recommendations for best practices surrounding unit testing, source code control, naming conventions, etc. Many of the suggestions are familiar to experienced developers, but it's nice to see other peoples perspectives. Beginners will also find this section useful.

Chapter 14: Putting it all Together - walks the reader through develoment of a nicely-structured web application using Struts, Tiles and
iBATIS. There's more time spent on Struts and Tiles than on iBATIS, so the chapter seems slightly out-of-place. On the other hand, it's a good introduction to multi-tier architecture that beginning enterprise developers can make good use of.

Appendix: iBATIS.NET Quick Start - gives a short overview of the .NET port of iBATIS.

Rating

The book is readable and nicely structured. It has numerous examples and explanatory text, yet doesn't seem bloated. Experienced developers can read book quickly to understand the philosophy and assumptions behind the iBATIS framework. The authors obviously have extensive experience in enterprise development, and beginners will benefit from their insights (on iBATIS and on enterprise development in general), which are scattered liberally throughout the book.

The authors are developers of iBATIS, so you would expect them to promote the iBATIS framework in the book, and they do. Refreshingly, they also point out situations where iBATIS might not be the right solution, and demonstrate other solutions that still fit with the iBATIS framework.

There are one or two non-technical errors, as expected in a first edition (for example there's a section that talks about a class called BaseBean, but the heading refers to BeanBase), but not so many as to be distracting.

Relevance  
Readability
Overall

Resources

http://ibatis.apache.org/
http://www.manning.com/

Purchase iBatis in Action on Amazon and help Javalobby.