Sleeping spatial functions keep throwing unexpected AST node

I am trying to query the spatial relationships between my objects, but keep getting this exception:

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: ( near line 1,

My entities work correctly, as does the mapping. I believe my request has a problem:

SELECT r FROM Regiao r, Imovel i WHERE r.nivel = :nivel AND contains(r.regiao, i.latlng)

If both r.regiao and i.latln are displayed in a GeometryType (one of which is a polygon and the other a point.

P .: When I asked a question, I finally understood this problem.

+4
source share
2 answers

Apparently the spatial function syntax requires you to test it against boolean values, so I had to add a comparison at the end of my query:

SELECT r FROM Regiao r, Imovel i WHERE r.nivel = :nivel AND contains(r.regiao, i.latlng) = TRUE
+12

, , . SpatialRestriction, . , , - .

Criteria criteria = getCurrentSession().createCriteria(Region.class);
criteria.add(SpatialRestrictions.contains("theGeom", location));
0

All Articles