// Path: DB/src/main/java/com/zhaoxiaodan/mirserver/db/DB.java
// public class DB {
// 
// 	private static SessionFactory  ourSessionFactory;
// 	private static ServiceRegistry serviceRegistry;
// 
// 	public static void init() throws Exception {
// 		Configuration configuration = new Configuration();
// 		configuration.configure();
// 
// 		serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
// 		ourSessionFactory = configuration.buildSessionFactory();
// 	}
// 
// 	public static Session getSession() {
// 		return ourSessionFactory.getCurrentSession();
// 	}
// 
// 	public static void save(Object object) {
// 		getSession().save(object);
// 	}
// 
// 	public static void update(Object object) {
// 		getSession().update(object);
// 	}
// 
// 	public static void delete(Object object) {
// 		getSession().delete(object);
// 	}
// 
// 	public static List query(Class clazz, SimpleExpression... simpleExpressions) {
// 		Criteria criteria = getSession().createCriteria(clazz);
// 		for (SimpleExpression simpleExpression : simpleExpressions) {
// 			criteria.add(simpleExpression);
// 		}
// 		List result = criteria.list();
// 		return result;
// 	}
// 
// }


import com.zhaoxiaodan.mirserver.db.DB;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
package com.zhaoxiaodan.mirserver.tools;



public class ImportDB {

    public Map<String, String> tables = new HashMap<String, String>() {
        {
            put("SERVERINFO", "数据文件/MIR2_PUBLIC_SERVERINFO.csv");
            put("STDITEM", "数据文件/MIR2_PUBLIC_STDITEM.csv");
            put("STDMONSTER", "数据文件/MIR2_PUBLIC_STDMONSTER.csv");
            put("STDMAGIC", "数据文件/MIR2_PUBLIC_STDMAGIC.csv");
        }
    };

    /**
     * 因为Hibernate创建的表的字段顺序问题, 利用反射导入原DBC数据库导出的文件
     *
     * @throws Exception
     */
    public void importAll() {
        try {
// Path: DB/src/main/java/com/zhaoxiaodan/mirserver/db/DB.java
// public class DB {
// 
// 	private static SessionFactory  ourSessionFactory;
// 	private static ServiceRegistry serviceRegistry;
// 
// 	public static void init() throws Exception {
// 		Configuration configuration = new Configuration();
// 		configuration.configure();
// 
// 		serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
// 		ourSessionFactory = configuration.buildSessionFactory();
// 	}
// 
// 	public static Session getSession() {
// 		return ourSessionFactory.getCurrentSession();
// 	}
// 
// 	public static void save(Object object) {
// 		getSession().save(object);
// 	}
// 
// 	public static void update(Object object) {
// 		getSession().update(object);
// 	}
// 
// 	public static void delete(Object object) {
// 		getSession().delete(object);
// 	}
// 
// 	public static List query(Class clazz, SimpleExpression... simpleExpressions) {
// 		Criteria criteria = getSession().createCriteria(clazz);
// 		for (SimpleExpression simpleExpression : simpleExpressions) {
// 			criteria.add(simpleExpression);
// 		}
// 		List result = criteria.list();
// 		return result;
// 	}
// 
// }


// Path: Tools/src/main/java/com/zhaoxiaodan/mirserver/tools/ImportDB.java
import com.zhaoxiaodan.mirserver.db.DB;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;

package com.zhaoxiaodan.mirserver.tools;



public class ImportDB {

    public Map<String, String> tables = new HashMap<String, String>() {
        {
            put("SERVERINFO", "数据文件/MIR2_PUBLIC_SERVERINFO.csv");
            put("STDITEM", "数据文件/MIR2_PUBLIC_STDITEM.csv");
            put("STDMONSTER", "数据文件/MIR2_PUBLIC_STDMONSTER.csv");
            put("STDMAGIC", "数据文件/MIR2_PUBLIC_STDMAGIC.csv");
        }
    };

    /**
     * 因为Hibernate创建的表的字段顺序问题, 利用反射导入原DBC数据库导出的文件
     *
     * @throws Exception
     */
    public void importAll() {
        try {
            DB.init();