TableDao { public int[] batchUpdate(List<T> entities, Hints...hints) throws SQLException { return client.batchUpdate(entities, hints); } TableDao(String logicDbName, Class<T> entityType); T queryByPk(T pk, Hints...hints); List<T> queryBySample(T sample, Hints...hints); List<T> queryBySample(T sample, PageRange range, Hints...hints); long countBySample(T sample, Hints...hints); int insert(T entity, Hints...hints); int insert(List<T> entities, Hints...hints); int[] batchInsert(List<T> entities, Hints...hints); int deleteByPk(T pk, Hints...hints); int deleteBySample(T sample, Hints...hints); int[] batchDelete(List<T> entities, Hints...hints); int update(T entity, Hints...hints); int[] batchUpdate(List<T> entities, Hints...hints);  }
@Test public void testBatchUpdate() throws Exception { List<Person> pl = new ArrayList<>(); for (int k = 0; k < TABLE_MODE; k++) { Person pk = new Person(); pk.setPeopleID(k + 1); pk.setName("Tom"); pk.setCountryID(100); pk.setCityID(200); pl.add(pk); } int[] ret = dao.batchUpdate(pl); for(int i: ret) assertEquals(1, i); assertEquals(4, ret.length); for(Person pk: pl) { pk = dao.queryByPk(pk); assertEquals("Tom", pk.getName()); assertEquals(100, pk.getCountryID().intValue()); assertEquals(200, pk.getCityID().intValue()); } }