是否可以在其他项目中使用资源(Spring Boot)?

时间:2019-02-27 21:03:48

标签: mysql jpa geolocation spring-data-jpa

我想使用MySQL 10和Point for Geolocations。 我的方言属性是:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

我在实体上立即使用:

@Column(name="location", columnDefinition = "POINT") 
private org.springframework.data.geo.Point location;

错误消息是:

com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Cannot get geometry object from data you send to the GEOMETRY field

我尝试使用JpaRepository => save()保存它

使用JPA可以吗?

1 个答案:

答案 0 :(得分:0)

spring.jpa.properties.hibernate.dialect = org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect

spring.jpa.properties.hibernate.dialect = org.hibernate.spatial.dialect.h2geodb.GeoDBDialect 尝试使用两种版本的方言时,不确定哪一种将满足您的需求