我的框架是ssh,数据库中设置了唯一索引,为避免重复数据写入,然后在service中写了try catch ConstraintViolationException的 捕捉异常,cath里没有做任何操作,也就是为了避免如果重复了报一样则使整个service不提交,但是依旧会影响到提交报错don't flush the Session after an exception occurs