我的框架是ssh,数据库中设置了唯一索引,为避免重复数据写入,然后在service中写了try catch ConstraintViolationException的 捕捉异常,cath里没有做任何操作,也就是为了避免如果重复了报一样则使整个service不提交,但是依旧会影响到提交报错don't flush the Session after an exception occurs
don't flush the Session after an exception occurs
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
fix_bugs 2024-05-07 14:04关注你应该开启了自动提交,自动提交发生在没有捕获到异常时,你添加的try catch就是造成外部无法捕获异常的原因。
解决 无用评论 打赏 举报