亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

org.hibernate.engine.jdbc.spi.SqlExceptionHelper

org.hibernate.engine.jdbc.spi.SqlExceptionHelper

ibeautiful 2022-08-17 17:05:58
在這里,我試圖找到所有在我提供的范圍內的實體。我的意思是,如果我給出一個特定半徑的圓,它必須顯示所有實體的位置坐標位于給定的圓內。我正在使用休眠空間來實現這一點。但是在JPA存儲庫接口中獲得提到的錯誤。這是 ,pom.xml<dependency>    <groupId>org.hibernate</groupId>    <artifactId>hibernate-entitymanager</artifactId></dependency><dependency>    <groupId>org.hibernate</groupId>    <artifactId>hibernate-spatial</artifactId>    <version>5.2.12.Final</version></dependency><dependency>    <groupId>org.opengeo</groupId>    <artifactId>geodb</artifactId>    <version>${project.version}</version></dependency><dependency>    <groupId>mysql</groupId>    <artifactId>mysql-connector-java</artifactId>    <version>6.0.6</version></dependency>Jpa Repository,public interface ResourceRepository extends ExtendedJpaRepository<Resource, String> {       @Query(value = "select resource from Resource resource where within(resource.address.location, :circle) = true")    List<Resource> test(@Param("circle") Geometry circle);}Resource.java,@Entity@NoArgsConstructorpublic class Resource extends UUIDEntity2 implements IsResource {    @Type(type = "org.hibernate.spatial.GeometryType")    @OneToOne    private Address address;    /*getters setters*/}Address.java,@Entitypublic class Address extends UUIDEntity2 implements HasEmailAddress, HasLocation {    @Embedded    @Column(columnDefinition = "point")    private Location location;    /*getters setters*/}location.java,@Embeddable@Value(staticConstructor = "of")@RequiredArgsConstructor(staticName = "of")public class Location implements Serializable {    @Column(nullable = true)    private Double lat;    @Column(nullable = true)    private Double lon;}測試    @Inject    private ResourceRepository resourceRepository;    public Geometry createCircle(double x, double y, double radius) {        GeometricShapeFactory shapeFactory = new GeometricShapeFactory();        shapeFactory.setNumPoints(32);        shapeFactory.setCentre(new Coordinate(x, y));        shapeFactory.setSize(radius * 2);        return shapeFactory.createCircle();    }
查看完整描述

1 回答

?
森欄

TA貢獻1810條經驗 獲得超5個贊

聽起來你沒有配置MySQL。您能驗證您是否有該行嗎?SpatialDialect

hibernate.dialect=org.hibernate.spatial.dialect.mysql.MySQL56SpatialDialect

在文件中。hibernate.properties

您還可以檢查日志,了解Hibernate實際使用的方言。它的名稱中應包含“空間”,以便空間函數可用于休眠。


查看完整回答
反對 回復 2022-08-17
  • 1 回答
  • 0 關注
  • 570 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號