我正在开发一个将在MySql和MySql上运行的应用程序。
我有一个“几何”类型的空间字段。
通过使用:
@Column(columnDefinition = "geometry")
private Point geometry;(点为org.springframework.data.geo.Point)
Hibernate正确地创建了字段(hbm2ddl)。
但是插入任何点都不起作用。我得到:数据截断:无法从您发送到几何字段的数据中获取几何对象
我使用spring-boot-jpa-starter..而不是直接休眠。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>5.2.2.Final</version>
</dependency>致以问候,Ido
发布于 2017-01-01 10:53:20
您好,我已经成功地在JPA中映射了一个点。下面是我所做的:
com.vividsolutions jts 1.13 org.hibernate hibernate-spatial 5.2.5最终的
@Column( locationpoint;
locationRepository.findOne((long) 1).getLocationpoint().getX();locationRepository.findOne((long) long
我的解决方案基于Matti Tahvonen的例子:
https://github.com/mstahv/spring-boot-spatial-example
希望这能有所帮助。
https://stackoverflow.com/questions/39147145
复制相似问题