Class OracleSpatialJdbcOperations
java.lang.Object
com.oracle.spring.spatial.OracleSpatialJdbcOperations
Spring JDBC-oriented entry point for working with Oracle Spatial and
GeoJSON-backed
SDO_GEOMETRY values.-
Constructor Summary
ConstructorsConstructorDescriptionOracleSpatialJdbcOperations(OracleSpatialProperties properties) Creates a new operations helper backed by the provided properties. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.jdbc.core.simple.JdbcClient.StatementSpecbind(org.springframework.jdbc.core.simple.JdbcClient.StatementSpec statement, SpatialJdbcBindable... parts) Applies bind parameters from the given spatial parts to aJdbcClient.StatementSpec.distance(String geometryColumn, SpatialGeometry geometry, Number tolerance) Returns a distance expression based onSDO_GEOM.SDO_DISTANCEusing the configured default unit and a caller-provided tolerance.distance(String geometryColumn, SpatialGeometry geometry, Number tolerance, String unit) Returns a distance expression based onSDO_GEOM.SDO_DISTANCEusing the supplied tolerance and unit.filter(String geometryColumn, SpatialGeometry geometry) Returns anSDO_FILTER(...)predicate.fromGeoJson(SpatialGeometry geometry) Returns an expression that converts a bindable GeoJSON geometry intoSDO_GEOMETRY.org.springframework.jdbc.core.RowMapper<String> geoJsonRowMapper(String columnLabel) Returns a Spring JDBCRowMapperthat reads a GeoJSON projection column from a result set.Creates a bindable geometry value using the configured default SRID.Creates a bindable geometry value using the supplied SRID.nearestNeighbor(String geometryColumn, SpatialGeometry geometry, int numResults) Returns anSDO_NN(...)predicate using Oracle operator id1.Returns theSDO_NN_DISTANCE(1)expression for use in select lists or order clauses afternearestNeighbor(String, SpatialGeometry, int).relate(String geometryColumn, SpatialGeometry geometry, SpatialRelationMask mask) Returns anSDO_RELATE(...)predicate for the given relationship mask.Returns a GeoJSON projection expression for the given geometry column.withinDistance(String geometryColumn, SpatialGeometry geometry, Number distance) Returns anSDO_WITHIN_DISTANCE(...)predicate using the configured default distance unit.withinDistance(String geometryColumn, SpatialGeometry geometry, Number distance, String unit) Returns anSDO_WITHIN_DISTANCE(...)predicate using the supplied distance unit token.
-
Constructor Details
-
OracleSpatialJdbcOperations
Creates a new operations helper backed by the provided properties.- Parameters:
properties- spatial defaults used for SRID and distance units
-
-
Method Details
-
geometry
Creates a bindable geometry value using the configured default SRID.- Parameters:
geoJson- GeoJSON payload- Returns:
- spatial geometry wrapper
-
geometry
Creates a bindable geometry value using the supplied SRID.- Parameters:
geoJson- GeoJSON payloadsrid- Oracle Spatial SRID- Returns:
- spatial geometry wrapper
-
fromGeoJson
Returns an expression that converts a bindable GeoJSON geometry intoSDO_GEOMETRY. This is useful for inserts, updates, and advanced custom SQL.- Parameters:
geometry- geometry value to convert- Returns:
- bindable SQL expression
-
toGeoJson
Returns a GeoJSON projection expression for the given geometry column.- Parameters:
geometryColumn- geometry column or expression- Returns:
- SQL expression suitable for a select list
-
filter
Returns anSDO_FILTER(...)predicate.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry value- Returns:
- bindable spatial predicate
-
relate
public SpatialPredicate relate(String geometryColumn, SpatialGeometry geometry, SpatialRelationMask mask) Returns anSDO_RELATE(...)predicate for the given relationship mask.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry valuemask- relationship mask- Returns:
- bindable spatial predicate
-
withinDistance
public SpatialPredicate withinDistance(String geometryColumn, SpatialGeometry geometry, Number distance) Returns anSDO_WITHIN_DISTANCE(...)predicate using the configured default distance unit.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry valuedistance- distance threshold- Returns:
- bindable spatial predicate
-
withinDistance
public SpatialPredicate withinDistance(String geometryColumn, SpatialGeometry geometry, Number distance, String unit) Returns anSDO_WITHIN_DISTANCE(...)predicate using the supplied distance unit token.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry valuedistance- distance thresholdunit- Oracle distance unit token- Returns:
- bindable spatial predicate
-
nearestNeighbor
public SpatialPredicate nearestNeighbor(String geometryColumn, SpatialGeometry geometry, int numResults) Returns anSDO_NN(...)predicate using Oracle operator id1.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry valuenumResults- Oraclesdo_num_resvalue- Returns:
- bindable spatial predicate
-
nearestNeighborDistance
Returns theSDO_NN_DISTANCE(1)expression for use in select lists or order clauses afternearestNeighbor(String, SpatialGeometry, int).- Returns:
- SQL expression
-
distance
public SpatialExpression distance(String geometryColumn, SpatialGeometry geometry, Number tolerance) Returns a distance expression based onSDO_GEOM.SDO_DISTANCEusing the configured default unit and a caller-provided tolerance.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry valuetolerance- Oracle Spatial tolerance- Returns:
- bindable SQL expression
-
distance
public SpatialExpression distance(String geometryColumn, SpatialGeometry geometry, Number tolerance, String unit) Returns a distance expression based onSDO_GEOM.SDO_DISTANCEusing the supplied tolerance and unit.- Parameters:
geometryColumn- geometry column or expressiongeometry- bindable geometry valuetolerance- Oracle Spatial toleranceunit- Oracle distance unit token- Returns:
- bindable SQL expression
-
geoJsonRowMapper
-
bind
public org.springframework.jdbc.core.simple.JdbcClient.StatementSpec bind(org.springframework.jdbc.core.simple.JdbcClient.StatementSpec statement, SpatialJdbcBindable... parts) Applies bind parameters from the given spatial parts to aJdbcClient.StatementSpec.- Parameters:
statement- JDBC statement specparts- spatial parts carrying bind values- Returns:
- updated statement
-