如何使用Querydsl Spatial进行INTERSECTS操作

时间:2014-09-09 10:11:39

标签: querydsl hibernate-spatial

我试图在Querydsl上使用INTERSECTS操作:

PolygonPath<Polygon> polygonpath = new PolygonPath<Polygon>(entityPath, "location");
Geometry geometry = Wkt.fromWkt("POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))");
BooleanExpression intersectsExpression = polygonpath.intersects(geometry);

当生成BooleanExpression时,我收到以下消息:

unknown operation with operator com.mysema.query.spatial.SpatialOps#INTERSECTS and args [entity.location, POLYGON((30 10,40 40,20 40,10 20,30 10))]

我正在使用HibernateSpatial ..然后我尝试执行以下操作:

根据您的HibernateSpatialSupport创建我自己的类,以创建在HibernateSpatial上使用的有效交叉操作。

我用:

创建了一个HibernateSpatialOps

private static final String NS = HibernateSpatialOps.class.getName(); public static final Operator<Object> INTERSECTS = new OperatorImpl<Object>( NS, "intersects({0}, {1})");

当我生成带有交叉操作的BooleanExpression时,会出现以下消息:

unknown operation with operator org.project1.querydsl.HibernateSpatialOps#intersects({0}, {1}) and args [entity.location, POLYGON ((-0.948944091796875 39.49052944781087, -0.4988479614257812 39.49052944781087, -0.4988479614257812 39.39030533696812, -0.948944091796875 39.39030533696812, -0.948944091796875 39.49052944781087))]

你能帮助我吗?

最诚挚的问候,

1 个答案:

答案 0 :(得分:0)

Querydsl尚未提供Hibernate Spatial支持。请随意提出拉动请求。