关于 Spring 事务和异常的问题

Question on Spring Transaction and exception

我看了几个帖子,但我还是不明白我的问题。

我有以下代码:

@Component
class API{
...
public String getTranslations(){
    serviceLayer.getTranslations()
}
...
}

class ServiceLayer(){
....
public String getTranslations(){

...

for (final PulldownEntry docStructure : docStructures)
try{
    structure.getTranslations(docStructure .getId())
}
catch(Exception e){
 do nothing
}

}
....

}


class Structure{
....
@Transactional(propagation = Propagation.REQUIRED, noRollbackFor = Exception.class, readOnly = true)
public String getTranslations(Long structureId){

    DataStructure dataStructure = dao.getObject(structureId);
if(dataStructure.hasNoData())
throw CustomException();

return dataStructure .getXML():


}
....
}

当抛出异常时,我得到 "UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only" 为什么?

假设它可以与这个相关:https://jira.spring.io/browse/SPR-9746

The current workaround is to remove the readOnly flag.