⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysqlconfig.java

📁 hibernate应用测试,初学hibernate 的会员可以看看.
💻 JAVA
字号:
package com.config;

import com.ibatis.sqlmap.client.SqlMapClient;
import java.io.Reader;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class MySqlConfig {
    private static final SqlMapClient sqlMap;
    static {
        try {
            String resource = "com/config/SqlMapConfig.xml";
            Reader reader = Resources.getResourceAsReader(resource);
            sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);

        } catch (Exception e) {
            // If you get an error at this point, it matters little what it was. It is going to be
            // unrecoverable and we will want the app to blow up good so we are aware of the
            // problem. You should always log such errors and re-throw them in such a way that
            // you can be made immediately aware of the problem.
            e.printStackTrace();
            throw new RuntimeException(
                    "Error initializing MyAppSqlConfig class. Cause: " + e);
        }
    }

    public static SqlMapClient getSqlMapInstance() {
        return sqlMap;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -