Skip to content

Conversation

@rdegnan
Copy link
Contributor

@rdegnan rdegnan commented Nov 21, 2018

Now that R2DBC 1.0M6 supports array types, allow CollectionLike types to be handled in EntityRowMapper. I verified that this works for both arrays and collection types such as List.

@mp911de
Copy link
Member

mp911de commented Nov 22, 2018

Thanks a lot. The mentioned restriction originates from a different context. In Spring Data JDBC we map collections of items to a JOIN table. Leveraging database support for collection-like column types makes sense for R2DBC. We haven't really considered supporting relations (JOINs) through object mapping yet as we need to provide more fundamental functionality first.

@schauder we might want to reconsider the mentioned assumption to support collection-typed columns for simple types in Spring Data JDBC.

@mp911de
Copy link
Member

mp911de commented Nov 26, 2018

Depends on #24 as we need integration tests. Enabling this feature will unblock reading of collections but we need also a possibility to store array/collection values. I filed #26 to track writing of collections/arrays.

@schauder
Copy link
Contributor

schauder commented Nov 26, 2018

This also relates to https://jira.spring.io/projects/DATAJDBC/issues/DATAJDBC-259 which is about storing collections of primitive types, but the expectation is that they get stored just as an entity with a single property.

How about supporting them via conversions? By registering a CustomConverter for Collection it becomes a simple type.
We might need a way to slap additional information to a conversion though since I expect it might affect SQL generation.

Databases that support Arrays/Lists as column type could then trigger a registration of such a converter.

This, in turn, is similar/related to https://jira.spring.io/browse/DATAJDBC-239 and https://jira.spring.io/projects/DATAJDBC/issues/DATAJDBC-284

@mp911de
Copy link
Member

mp911de commented Nov 26, 2018

Converters apply on a property type basis. One might want to use various strategies in the same application or stick with the same mapping strategy as for databases that don't support array type. A @Type annotation (applied on a per-property basis) might be less invasive.

In any case, let's continue the discussion on the actual tickets.

mp911de pushed a commit that referenced this pull request Dec 3, 2018
EntityRowMapper now passes-thru values for Collection-like types such as array. Arrays are supported by Postgres.

Original pull request: #22.
mp911de added a commit that referenced this pull request Dec 3, 2018
Add author tag. Add unit test for EntityRowMapper.
mp911de added a commit that referenced this pull request Dec 3, 2018
We now support custom conversions via R2dbcCustomConversions. Custom conversions introduces simple types that depend on the used dialect. Custom conversions and simple types are held in RelationalConverter and MappingContext.

Simple types and conversions are used by DatabaseClient and repository support to properly apply registered converters and support native types such as array-columns.

Related tickets: #22, #26.
@mp911de
Copy link
Member

mp911de commented Dec 3, 2018

Thanks, @rdegnan for your pull request. I incorporated your change in #31 that also contains conversion and write support for array-typed columns.

Closing this pull request.

@mp911de mp911de closed this Dec 3, 2018
schauder pushed a commit that referenced this pull request Dec 4, 2018
EntityRowMapper now passes-thru values for Collection-like types such as array. Arrays are supported by Postgres.

Original pull request: #22.
schauder pushed a commit that referenced this pull request Dec 4, 2018
Add author tag. Add unit test for EntityRowMapper.
schauder pushed a commit that referenced this pull request Dec 4, 2018
We now support custom conversions via R2dbcCustomConversions. Custom conversions introduces simple types that depend on the used dialect. Custom conversions and simple types are held in RelationalConverter and MappingContext.

Simple types and conversions are used by DatabaseClient and repository support to properly apply registered converters and support native types such as array-columns.

Related tickets: #22, #26.
schauder pushed a commit that referenced this pull request Dec 7, 2018
EntityRowMapper now passes-thru values for Collection-like types such as array.
Arrays are supported by Postgres.

Original pull request: #22.
schauder pushed a commit that referenced this pull request Dec 7, 2018
Add author tag. Add unit test for EntityRowMapper.

Original pull request: #31.
schauder pushed a commit that referenced this pull request Dec 7, 2018
We now support custom conversions via R2dbcCustomConversions.
Custom conversions introduces simple types that depend on the used dialect.
Custom conversions and simple types are held in RelationalConverter and MappingContext.

Simple types and conversions are used by DatabaseClient and repository support to properly apply registered converters and support native types such as array-columns.

Related tickets: #22, #26.
Original pull request: #31.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants