Conversation
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
| assertThat(properties.getDefaultDistanceUnit()).isEqualTo("M"); | ||
| assertThat(converter.fromGeoJsonSql(":geometry")).isEqualTo("SDO_UTIL.FROM_GEOJSON(:geometry, null, 4326)"); | ||
| assertThat(converter.distanceClause(500)).isEqualTo("distance=500 unit=M"); | ||
| assertThat(sqlBuilder.withinDistancePredicate("geometry", "shape", 500)) |
There was a problem hiding this comment.
we probably should not use string sql builders. can something similar be done with jdbcclient?
There was a problem hiding this comment.
these are just helpers to create geospatial sql fragments, that are then actually used in a JdbcClient when we want to run a query (see LandmarkService for example)
...e-spatial/src/test/java/com/oracle/database/spring/spatial/SpatialSampleApplicationTest.java
Outdated
Show resolved
Hide resolved
...e-spatial/src/test/java/com/oracle/database/spring/spatial/SpatialSampleApplicationTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
|
general q's:
|
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
| } | ||
|
|
||
| @Override | ||
| public String mapRow(ResultSet rs, int rowNum) throws SQLException { |
There was a problem hiding this comment.
if we're doing rs.getString(), when would I use this over a plain row mapper?
There was a problem hiding this comment.
gpt says:
The main value is not that it does something rs.getString() cannot do. The value is that it gives the starter a small, explicit Spring JDBC integration point for the common case of projecting SDO_UTIL.TO_GEOJSON(...) back to a GeoJSON String.
So the reasons to use it over an inline lambda are:
- it makes the intent obvious: spatial.geoJsonRowMapper("geometry") reads as “map this projected spatial column as GeoJSON”
- it avoids repeating the same one-line mapper everywhere
- it gives the starter at least one concrete RowMapper integration hook, which was part of the review feedback
- it gives us a stable place to evolve behavior later if Oracle/JDBC handling ever needs to be less trivial than getString()
That said, I think the reviewer’s instinct is fair: today it is a very thin wrapper. So I’d probably add that if the team feels this is too small to justify a public class, I’d be comfortable with either:
- keeping geoJsonRowMapper(...) on OracleSpatialJdbcOperations but making the implementation class non-public, or
- inlining it and dropping the named class entirely
My own preference would be:
- keep the geoJsonRowMapper(...) factory method as the public API
- make OracleSpatialGeoJsonRowMapper an internal implementation detail if we want to reduce surface area
So the short answer is: it is about starter-level Spring integration and readability, not extra mapping power today.
wdyt @anders-swanson
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
...spatial-data-tools/src/test/java/com/oracle/spring/spatial/OracleSpatialIntegrationTest.java
Outdated
Show resolved
Hide resolved
...spatial-data-tools/src/test/java/com/oracle/spring/spatial/OracleSpatialIntegrationTest.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Override | ||
| public String mapRow(ResultSet rs, int rowNum) throws SQLException { |
There was a problem hiding this comment.
also curious if geojson we can return as OSON? Java string doesn't seem too useful - thoughts? maybe we can offer rowmapper to cast geojson as a java object? would have to learn a bit more about how spatial best works with JDBC to offer a good suggestion here
| @Test | ||
| void geoJsonRoundTrip() { | ||
| SpatialExpression geometry = spatial.toGeoJson("geometry"); | ||
| String geoJson = jdbcClient.sql("select " + geometry.selection("geometry") + " from landmarks where id = :id") |
There was a problem hiding this comment.
the plan said not to use string SQL fragments but this still looks like SQL concatenation
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
Signed-off-by: Mark Nelson <mark.x.nelson@oracle.com>
| @@ -0,0 +1,48 @@ | |||
| create table if not exists landmarks ( | |||
| id number primary key, | |||
There was a problem hiding this comment.
Maybe use generated ID? (id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY)
|
|
||
| public Landmark getById(Long id) { | ||
| SpatialExpression geometry = spatial.toGeoJson("geometry"); | ||
| return jdbcClient.sql("select id, name, category, " |
📌 Description
Adds a new Oracle Spatial starter for the database starters project, including:
oracle-spring-boot-spatial-data-toolswith Spring Boot auto-configuration and GeoJSON-first Oracle Spatial helpersoracle-spring-boot-starter-spatialas the thin dependency starteroracle-spring-boot-sample-spatialas a REST sample backed by Oracle Spatial and TestcontainersThe new starter provides:
OracleSpatialGeoJsonConverterforSDO_UTIL.FROM_GEOJSONandSDO_UTIL.TO_GEOJSONOracleSpatialSqlBuilderforSDO_FILTER,SDO_RELATE,SDO_WITHIN_DISTANCE, andSDO_NNOracleSpatialPropertieswithoracle.database.spatial.*configurationThis PR also includes:
✅ Checklist
🔗 Related Issue
n/a
📸 Screenshots / Logs (if applicable)
Test commands run successfully: