Skip to content

Commit fe66a43

Browse files
committed
Process review comments.
- Wrapped SqlException and rethrow it. - remove AggregateReferenceConverters completely. It was no longer used. Closes #1828 Original pull request #2062
1 parent 93d2aaf commit fe66a43

File tree

3 files changed

+12
-237
lines changed

3 files changed

+12
-237
lines changed

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/AggregateReferenceConverters.java

Lines changed: 0 additions & 136 deletions
This file was deleted.

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MappingJdbcConverter.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@
2727
import org.apache.commons.logging.Log;
2828
import org.apache.commons.logging.LogFactory;
2929
import org.springframework.context.ApplicationContextAware;
30+
import org.springframework.core.convert.ConversionException;
31+
import org.springframework.core.convert.ConversionFailedException;
3032
import org.springframework.core.convert.converter.Converter;
33+
import org.springframework.dao.DataAccessException;
34+
import org.springframework.dao.NonTransientDataAccessException;
3135
import org.springframework.data.convert.CustomConversions;
3236
import org.springframework.data.jdbc.core.mapping.AggregateReference;
3337
import org.springframework.data.jdbc.core.mapping.JdbcValue;
3438
import org.springframework.data.jdbc.support.JdbcUtil;
3539
import org.springframework.data.mapping.context.MappingContext;
3640
import org.springframework.data.mapping.model.SimpleTypeHolder;
3741
import org.springframework.data.mapping.model.ValueExpressionEvaluator;
42+
import org.springframework.data.relational.core.conversion.DbActionExecutionException;
3843
import org.springframework.data.relational.core.conversion.MappingRelationalConverter;
3944
import org.springframework.data.relational.core.conversion.ObjectPath;
4045
import org.springframework.data.relational.core.conversion.RelationalConverter;
@@ -179,8 +184,7 @@ protected Object readTechnologyType(Object value) {
179184
try {
180185
return array.getArray();
181186
} catch (SQLException e) {
182-
LOG.info("Failed to extract a value of type %s from an Array; Attempting to use standard conversions", e);
183-
187+
throw new FailedToAccessJdbcArrayException(e);
184188
}
185189
}
186190

@@ -301,6 +305,12 @@ protected RelationalPropertyValueProvider newValueProvider(RowDocumentAccessor d
301305
return super.newValueProvider(documentAccessor, evaluator, context);
302306
}
303307

308+
private static class FailedToAccessJdbcArrayException extends NonTransientDataAccessException {
309+
public FailedToAccessJdbcArrayException(SQLException e) {
310+
super("Failed to read array", e);
311+
}
312+
}
313+
304314
/**
305315
* {@link RelationalPropertyValueProvider} using a resolving context to lookup relations. This is highly
306316
* context-sensitive. Note that the identifier is held here because of a chicken and egg problem, while

spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/AggregateReferenceConvertersUnitTests.java

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)