ibatis工具类

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 {
private static SqlMapClient client;
    
    static{
        Reader reader = null;
        try {
//包名的路径
            reader = Resources.getResourceAsReader("../../SqlMapConfig.xml");
        } catch (IOException e) {
            e.printStackTrace();
        }
        client=SqlMapClientBuilder.buildSqlMapClient(reader);
    }
    public static SqlMapClient getClient() {
        return client;
    }
}

  

你可能感兴趣的:(java,xml,ibatis)