within”

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

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

  1. <dependency>
  2. <groupId>com.h2database</groupId>
  3. <artifactId>h2</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>org.hibernate</groupId>
  7. <artifactId>hibernate-spatial</artifactId>
  8. </dependency>

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

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

locationrepository.java文件

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

位置实体.java

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

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

暂无答案!

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

相关问题