within”

mdfafbf1  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(148)

在junit测试中的spring引导应用程序(h2内存数据库+hibernate空间)中,对于“within”查询,我在“not found”中得到了错误“function”st\u
pom.xml文件:

<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-spatial</artifactId>
</dependency>

测试/资源/应用程序.属性:

spring.datasource.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=va
spring.jpa.database=h2  
spring.jpa.database-platform=org.hibernate.spatial.dialect.h2geodb.GeoDBDialect

locationrepository.java文件

@Query(value = "select l from Location l where within(l.position, :box) = true")
List<Location> findByPositionWithin(@Param("box") org.locationtech.jts.geom.Geometry box);

位置实体.java

@Column(columnDefinition = "GEOMETRY")
private org.locationtech.jts.geom.Point position;

很明显,里面的别名st\u不见了。有没有办法解决这个问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题