diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/metadata/JdbcMetadataStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/metadata/JdbcMetadataStore.java index 32ae228c50..2faca2a224 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/metadata/JdbcMetadataStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/metadata/JdbcMetadataStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import javax.sql.DataSource; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.SmartLifecycle; import org.springframework.core.log.LogAccessor; -import org.springframework.dao.DuplicateKeyException; +import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.integration.metadata.ConcurrentMetadataStore; import org.springframework.jdbc.core.JdbcOperations; @@ -247,7 +247,7 @@ public class JdbcMetadataStore implements ConcurrentMetadataStore, InitializingB ps.setString(5, this.region); // NOSONAR magic number }); } - catch (DuplicateKeyException ex) { + catch (DataIntegrityViolationException ex) { return 0; } } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java index e1c9b4dc3d..e01bee4d27 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import org.springframework.core.log.LogMessage; import org.springframework.core.serializer.Deserializer; import org.springframework.core.serializer.Serializer; import org.springframework.core.serializer.support.SerializingConverter; -import org.springframework.dao.DuplicateKeyException; +import org.springframework.dao.DataIntegrityViolationException; import org.springframework.integration.jdbc.store.channel.ChannelMessageStorePreparedStatementSetter; import org.springframework.integration.jdbc.store.channel.ChannelMessageStoreQueryProvider; import org.springframework.integration.jdbc.store.channel.MessageRowMapper; @@ -473,7 +473,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto ps -> this.preparedStatementSetter.setValues(ps, message, groupId, this.region, this.priorityEnabled)); } - catch (@SuppressWarnings("unused") DuplicateKeyException e) { + catch (@SuppressWarnings("unused") DataIntegrityViolationException ex) { LOGGER.debug(() -> "The Message with id [" + getKey(message.getHeaders().getId()) + "] already exists.\n" + "Ignoring INSERT..."); diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java index 518fb85f2d..d7cbd4259f 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/AbstractConfigurableMongoDbMessageStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2023 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; -import org.springframework.dao.DuplicateKeyException; +import org.springframework.dao.DataIntegrityViolationException; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.MongoDatabaseFactory; import org.springframework.data.mongodb.core.FindAndModifyOptions; @@ -237,7 +237,7 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe try { this.mongoTemplate.insert(document, this.collectionName); } - catch (DuplicateKeyException e) { + catch (DataIntegrityViolationException e) { if (this.logger.isDebugEnabled()) { this.logger.debug("The Message with id [" + document.getMessageId() + "] already exists.\n" + "Ignoring INSERT and SELECT existing...");