I have a problem to set latitude and longitude to Point with the usager of Hibanate Spatial feature in Spring Boot.
I cannot set it as I guess there is a problem in columnDefinition
.
How can I fix it?
Here is the relevant part of the Entity class shown below
@Column(name = "POINT", columnDefinition = "geometry(Point,4326)")
private Point point;
public void setPoint(double latitude, double longitude) {
Coordinate coordinate = new Coordinate(latitude, longitude);
GeometryFactory geometryFactory = new GeometryFactory();
this.point = geometryFactory.createPoint(coordinate);
}
Here is the database configuration part of application.yml
spring:
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQLDialect
format_sql: true
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl