导入结果和错误处理
适用于 ✅ 开源版 ✅ 专业版 ✅ 企业版
执行完成后,可以使用一些诊断信息来实现错误处理
Loader<?> loader =
create.loadInto(BOOK)
.loadCSV(inputstream, encoding)
.fields(BOOK.ID, BOOK.AUTHOR_ID, BOOK.TITLE)
.execute();
// The number of processed rows
int processed = loader.processed();
// The number of stored rows (INSERT or UPDATE)
int stored = loader.stored();
// The number of ignored rows (due to errors, or duplicate rule)
int ignored = loader.ignored();
// The errors that may have occurred during loading
List<LoaderError> errors = loader.errors();
LoaderError error = errors.get(0);
// The exception that caused the error
DataAccessException exception = error.exception();
// The row that caused the error
int rowIndex = error.rowIndex();
String[] row = error.row();
// The query that caused the error
Query query = error.query();
反馈
您对此页面有任何反馈吗? 我们很乐意听取您的意见!