concept interface in category iBatis

appears as: n interface, interface, interfaces, interface, interfaces, The interface
iBatis in Action

This is an excerpt from Manning's book iBatis in Action.

To better understand these concerns and how they’re managed, it helps to separate the persistence layer into three basic parts: the abstraction layer, the persistence framework, and the driver or interface, as shown in the lower part of figure 1.3.

Listing 10.6. The interface for our DAO
package org.apache.mapper2.examples.chapter10.dao; import org.apache.mapper2.examples.bean.Account; import org.apache.mapper2.examples.bean.IdDescription; import java.util.List; import java.util.Map; public interface AccountDao { public void insert(Account account); public void update(Account account); public int delete(Account account); public int delete(Integer accountId); public List<Account> getAccountListByExample( Account account); public List<Map<String, Object>> getMapListByExample(Account account); public List<IdDescription> getIdDescriptionListByExample(Account account); public Account getById(Integer accountId); public Account getById(Account account); }

iBATIS provides a number of levels of customization. First, as a general best practice, iBATIS uses interfaces between design layers of the framework. This means that even if there isn’t a standard extension supported by the framework, the most an end user would need to do is implement the interface and replace the standard implementation with their own. We’ll see an example of this later in this chapter when we discuss customizing the SqlMapClient interface.