Skip to content

Consider JTS geometry types as simple types. #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

pete-setchell-kubra
Copy link
Contributor

Here's a quick PR that makes spring-data-r2dbc work with the native JTS types useful for work with PostGIS. These are natively supported in the r2dbc-postgresql driver and should be picked up automatically now if the JTS dependencies are installed.

See: #1711

I've tested this locally and found that it removes the need for at custom postgres dialect. No additional dependency on JTS is necessary.

@@ -58,6 +58,18 @@ public class PostgresDialect extends org.springframework.data.relational.core.di
"io.r2dbc.postgresql.codec.Polygon") //
.forEach(s -> ifClassPresent(s, simpleTypes::add));

// support the native JTS types supported by r2dbc-postgresql
Stream.of("org.locationtech.jts.geom.Geometry", //
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is sufficient to just add Geometry as the other types are subclasses and therefore considered simple types.

@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 8, 2024
@mp911de mp911de linked an issue Jan 8, 2024 that may be closed by this pull request
mp911de pushed a commit that referenced this pull request Jan 8, 2024
mp911de added a commit that referenced this pull request Jan 8, 2024
Add Geometry super-type only as subtypes are considered simple types already. Ensure reflective simple type AOT registration.

Original pull request: #1713
See #1711
mp911de pushed a commit that referenced this pull request Jan 8, 2024
mp911de added a commit that referenced this pull request Jan 8, 2024
Add Geometry super-type only as subtypes are considered simple types already. Ensure reflective simple type AOT registration.

Original pull request: #1713
See #1711
mp911de pushed a commit that referenced this pull request Jan 8, 2024
mp911de added a commit that referenced this pull request Jan 8, 2024
Add Geometry super-type only as subtypes are considered simple types already. Ensure reflective simple type AOT registration.

Original pull request: #1713
See #1711
@mp911de
Copy link
Member

mp911de commented Jan 8, 2024

Thank you for your contribution. That's merged, polished, and backported now.

@mp911de mp911de closed this Jan 8, 2024
@mp911de mp911de added this to the 3.1.8 (2023.0.8) milestone Jan 8, 2024
@pete-setchell-kubra
Copy link
Contributor Author

Thanks for your work as maintainer! Great pointers and fast turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider JTS Geometry types as simple types
3 participants