SplitTableService { @Transactional(readOnly = false) public void prepareTableAndData() { int orderSize = 10000 * 1000; int splitTableSize = 10; List<Order> list=new ArrayList<>(10000); Map<Integer,List<Order>> map=new HashMap<>(10); IdWorker idWorker=new IdWorker(0,0); createTableMapper.createOrderTable(SINGLE_ORDER_TABLE_NAME); for(int i = 0; i < splitTableSize; i++) { createTableMapper.createOrderTable(TABLE_NAME + i); } for(int i=0;i<orderSize;i++){ Order order=new Order(i, idWorker.getId()); list.add(order); if(list.size()==10000){ orderMapper.save(getSaveMapByNameAndList(SINGLE_ORDER_TABLE_NAME,list)); list=new ArrayList(10000); } } }  @Transactional(readOnly = false) void prepareTableAndData();  }
@Test public void prepareTableAndData() throws Exception { splitTableService.prepareTableAndData(); }