需要自己写一个加载sqlMapConfig.xml 的工具类
SqlMapUtil.java
import java.io.IOException;
import java.io.Reader;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
public class SqlMapUtil {
private static SqlMapClient sqlmap;
static{
try {
Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");
sqlmap = SqlMapClientBuilder.buildSqlMapClient(reader);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static SqlMapClient getInstance(){
return sqlmap;
}
}
原文:http://www.cnblogs.com/yjjj/p/4273421.html