@@ -87,6 +87,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @author Milan Milanov
|
||||
* @author Mikhail Polivakha
|
||||
* @author Chirag Tailor
|
||||
* @author Vincent Galloy
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@Transactional
|
||||
@@ -1046,11 +1047,13 @@ class JdbcAggregateTemplateIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // GH-1460
|
||||
@EnabledOnFeature(SUPPORTS_ARRAYS)
|
||||
void readEnumArray() {
|
||||
|
||||
EnumArrayOwner entity = new EnumArrayOwner();
|
||||
entity.digits = new Color[]{Color.BLUE};
|
||||
|
||||
assertThat(template.save(entity)).isNotNull();
|
||||
template.save(entity);
|
||||
|
||||
assertThat(template.findById(entity.id, EnumArrayOwner.class).digits).isEqualTo(new Color[]{Color.BLUE});
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Mark Paluch
|
||||
* @author Jens Schauder
|
||||
* @author Chirag Tailor
|
||||
* @author Vincent Galloy
|
||||
* @see MappingContext
|
||||
* @see SimpleTypeHolder
|
||||
* @see CustomConversions
|
||||
@@ -175,7 +176,11 @@ public class BasicRelationalConverter implements RelationalConverter {
|
||||
|
||||
// TODO: We should add conversion support for arrays, however,
|
||||
// these should consider multi-dimensional arrays as well.
|
||||
if (value.getClass().isArray() && !value.getClass().getComponentType().isEnum() && (TypeInformation.OBJECT.equals(type) || type.isCollectionLike())) {
|
||||
if (value.getClass().isArray() //
|
||||
&& !value.getClass().getComponentType().isEnum() //
|
||||
&& (TypeInformation.OBJECT.equals(type) //
|
||||
|| type.isCollectionLike()) //
|
||||
) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user