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 IbatisUtil {
public static SqlMapClient getSqlMapClient(){
// String resource ="com/ibatis/sample/SqlMapConfig.xml";
// Reader reader;
// reader = Resources.getResourceAsReader(resource);
// XmlSqlMapClientBuilder xmlBuilder =
// new XmlSqlMapClientBuilder();
// SqlMapClient sqlMap = xmlBuilder.buildSqlMap(reader);
Reader reader = null ;
try {
reader = Resources.getResourceAsReader("SqlMapConfig.xml");
SqlMapClient sqlmap = SqlMapClientBuilder.buildSqlMapClient(reader);
return sqlmap;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
阅读(3564) | 评论(0) | 转发(0) |