Gulzar Hemani
Gulzar Hemani

Reputation: 41

Error while trying to save a point to Postgres DB using Postgis

My Entity class

@Type(type = "org.hibernate.spatial.GeometryType")
private Point location;

My spring boot configuration

spring.jpa.database=POSTGRESQL
spring.datasource.platform=postgres
spring.jpa.show-sql=true
#spring.jpa.hibernate.ddl-auto=validate
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=****
spring.datasource.username=***
spring.datasource.password=**
spring.jpa.database-platform=org.hibernate.spatial.dialect.postgis.PostgisDialect

I get the following error while trying to save.

ERROR: column "location" is of type point but expression is of type bytea Hint: You will need to rewrite or cast the expression. Position: 154

Upvotes: 0

Views: 534

Answers (1)

Jendrusk
Jendrusk

Reputation: 813

Seems like You're trying to store postgis geometry(point) data type into field which data type is postgresql point. They are not the same

Upvotes: 1

Related Questions