I have created a table in postgresql as:
CREATE TABLE feature (ID serial, feature_name text, geom geometry(GEOMETRYZ,4326));
I have to read the data using spring's reactive support for relational databases(r2dbc). I am not sure how to map geom column to a field in java class.
My incomplete class is:
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
import org.springframework.data.annotation.Id;
@Table
public class Feature {
@Id
private Long id;
@Column("feature_name")
private String featureName;
@Column("geom")
@Type(type="org.hibernate.spatial.GeometryType")
public com.vividsolutions.jts.geom.Geometry geom;
}
What java datatype would map to postgresql geometry? How to do it?
Edit: spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.postgis.PostgisDialect
Error is in code:
FeatureRepository featureRepository = applicationContext.getBean(FeatureRepository.class);
featureRepository.findAll().doOnNext(feature -> {
log.info(feature.toString());
}).blockLast(Duration.ofSeconds(10));
geomyou could tryST_AsGeoJSON(geom). I've also seen this syntax before:@Column(name = "geom", columnDefinition = "geometry(Point,4326)")