Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangwenping committed Mar 29, 2017
2 parents 930134c + 39b7aeb commit 434dc60
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ public static void commonTest(){
ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext(new String[]{"bean/db_applicationContext.xml"});
SqlSessionTemplate sqlSessionTemplate = (SqlSessionTemplate) classPathXmlApplicationContext.getBean("sqlSessionTemplate");
SqlSessionTemplate batchSqlSessionTemplate = new SqlSessionTemplate(sqlSessionTemplate.getSqlSessionFactory(), ExecutorType.BATCH);
SqlSession sqlSession = sqlSessionTemplate.getSqlSessionFactory().openSession(ExecutorType.BATCH, true);
SqlSession sqlSession = sqlSessionTemplate.getSqlSessionFactory().openSession(ExecutorType.BATCH, false);
try {
OrderMapper mapper = sqlSession.getMapper(OrderMapper.class);
Order order = new Order();
int startSize = 5000;
int endSize = startSize + 10;
int startSize = 30000;
int endSize = startSize + 200;
long startTime = System.currentTimeMillis();
for(int i= startSize; i< endSize; i++) {
long id = i;
order.setUserId(id);
Expand All @@ -34,6 +35,8 @@ public static void commonTest(){
mapper.insertEntity(order);
}
sqlSession.commit();
long endTime = System.currentTimeMillis();
System.out.println(endTime - startTime);
}catch (Exception e){

}finally {
Expand Down

0 comments on commit 434dc60

Please sign in to comment.