diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java index c0402b38a8e6..11e6efd30205 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java @@ -1090,11 +1090,9 @@ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() { } return switch (sqlState) { // Serialization Exception - case "40001" -> { - if ( message.contains("WriteTooOldError") ) - yield new TransactionSerializationException( message, sqlException, sql ); - else yield null; - } + case "40001" -> message.contains("WriteTooOldError") + ? new TransactionSerializationException( message, sqlException, sql ); + : null; // DEADLOCK DETECTED case "40P01" -> new LockAcquisitionException( message, sqlException, sql ); // LOCK NOT AVAILABLE