@Transactional noRollBackFor for subClasses

时间:2017-12-19 10:50:22

标签: java spring hibernate

让我们说我有这样的方法:

@Override
@Transactional(rollbackFor = ImportException.class, noRollbackFor = MultipleImportException.class, isolation = Isolation.READ_COMMITTED)
public ProcessImport doImport(File file) throws ImportException, RetryLaterException {
    try (InputStream in = new FileInputStream(file)) {
        return doImport(file, in);
    } catch (IOException e) {
        throw new ImportException(e);
    }
}

ImportException正在扩展Exception并且还有更多功能,MultipleImportException正在扩展ImportException。所以我的问题:是否没有可能将子类用于noRollBack-Policy?

0 个答案:

没有答案