package org.ces.test;



import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.ces.entity.User;
import org.ces.mapper.UserMapper;
import org.junit.Before;
import org.junit.Test;
import org.json.JSONObject;
/**
 */
public class TestDao {

	@Test
	public void test2() {
		SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
		InputStream input = TestDao.class.getClassLoader().getResourceAsStream("SqlMapConfig.xml");
		SqlSessionFactory factory = builder.build(input);
		SqlSession session1 = factory.openSession();

		UserMapper dao1 = session1.getMapper(UserMapper.class);
		
		for(int i=0; i<500;i++) {
			JSONObject json = new JSONObject();
			json.put("id",i);
			json.put("name", "testUser_"+i);
			dao1.insertUser(i, json);
		}
		session1.commit();
	}


	public static void main(String[] args) {

	}
}
