Dao文件也很简单:
public class QuestionsDao {
private String resource;
private Reader reader;
private SqlMapClient sqlMap; public QuestionsDao() throws Exception{
resource = "sqlmap/sqlMapConfig.xml";
reader = Resources.getResourceAsReader(resource);
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
}

public int getQuestionsCount() throws Exception {
Integer n = (Integer) sqlMap.queryForObject("getQuestionsCount", 
                                                                             null);
return n.intValue();
}
}