更新时间:2023-02-04 20:51:48
更新我的答案:
解决方案:-您不能因为事务需要而消耗异常,而应传播异常.
Solution:- You must not consume the exception and instead propagate the exception because of your transactional need.
更改为以下内容.添加了throw语句.
Change to following. have added throw statement.
try{
quoteLineDao.delete(new Long(44));
System.out.println("°°°°°°°°°°°°°°°°°°Line 44 deleted");
return quoteDao.save(quote);
} catch(Exception e){
Logger.getLogger(QuoteService.class).log(Logger.Level.ERROR, e);
throw e;
}
此链接中提供了逐步说明:无法提交JPA交易:标记为rollbackOnly的交易
Step by step explanation is available in this link: Could not commit JPA transaction: Transaction marked as rollbackOnly