首页 > 解决方案 > 从 Springboot 中过滤掉 Hibernate 引起的特殊错误日志

问题描述

我有一个 springboot 应用程序,并与 JPA for Oracle 数据库集成,目前我发现了一个问题,问题是,出于某种原因,休眠将抛出 HHH000315: Exception execution batch [org.hibernate.StaleStateException: Batch update returned unexpected来自更新 [0] 的行数;实际行数:0;预期:1;

这个异常将被休眠记录为错误

同时springboot框架会处理这个异常到这个org.springframework.orm.ObjectOptimisticLockingFailureException: Batch update returned unexpected row count from update[0]; 实际行数:0;预期:1;执行的语句:

因此,在我们的 ExceptionAdvice 中,我们处理了 ObjectOptimisticLockingFailureException 并登录到 INFO 级别。

所以,我的问题是,我怎样才能也将 StaleStateException 记录到 INFO 级别或忽略此异常记录?

标签: spring-boothibernatelogging

解决方案


推荐阅读