DasClient { public <T> int[] batchInsert(List<T> entities, Hints...hints) throws SQLException { final Hints hint = checkHints(hints); return internalExecute(hint, ()->{return delegate.batchInsert(entities, hint);}); } DasClient(DasDelegate delegate); 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); T queryObject(SqlBuilder builder); T queryObjectNullable(SqlBuilder builder); List<T> query(SqlBuilder builder); List<?> batchQuery(BatchQueryBuilder builder); int update(SqlBuilder builder); int[] batchUpdate(BatchUpdateBuilder builder); void call(CallBuilder builder); int[] batchCall(BatchCallBuilder builder); void execute(Transaction transaction, Hints...hints); T execute(CallableTransaction<T> transaction, Hints...hints);  }
@Test public void testBatchEmptyInsert() throws Exception { int[] ret = dao.batchInsert(Collections.emptyList()); for(int x: ret) assertEquals(0, x); }
@Test public void testBatchInsert() throws Exception { List<Person> pl = new ArrayList<>(); for(int k = 0; k < TABLE_MODE;k++) { Person p = new Person(); p.setName("jerry"); p.setCountryID(k); p.setCityID(k); pl.add(p); } int[] ret = dao.batchInsert(pl); for(int x: ret) assertEquals(batchRet, x); assertEquals(TABLE_MODE, ret.length); Person p = new Person(); p.setName("jerry"); List<Person> plist = dao.queryBySample(p); assertNotNull(plist); assertEquals(TABLE_MODE, plist.size()); for(Person p1: plist) assertNotNull(p1.getPeopleID()); }