Hibernate-spatial 5.4.22, hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect
Очень простой запрос:
import org.locationtech.jts.geom.Geometry;
...
@Query(value = "Select s from #{#entityName} s where within(s.shape, :bounds )= true")
public List<SiteModel> findWithinBounds(Geometry bounds);
Геометрия границ генерируется:
GeometryFactory gf = new GeometryFactory();
Polygon bounds = gf.createPolygon(sc);
bounds.setSRID(4326);
return newSiteService.findWithinBounds(bounds);
Но выдает ошибку
select
sitemodel0_.site_id as site_id1_1_,
sitemodel0_.accuracy as accuracy2_1_,
sitemodel0_.comment as comment3_1_,
sitemodel0_.country_code as country_4_1_,
sitemodel0_.directions as directio5_1_,
sitemodel0_.flag as flag6_1_,
sitemodel0_.height as height7_1_,
sitemodel0_.h_accuracy as h_accura8_1_,
sitemodel0_.h_method_id as h_method9_1_,
sitemodel0_.latitude as latitud10_1_,
sitemodel0_.longitude as longitu11_1_,
sitemodel0_.method_id as method_12_1_,
sitemodel0_.orig_coord as orig_co13_1_,
sitemodel0_.orig_system_id as orig_sy14_1_,
sitemodel0_.owner_id as owner_i15_1_,
sitemodel0_.shape as shape16_1_,
sitemodel0_.site_name as site_na17_1_
from
sc.site_proposed sitemodel0_
where
within(sitemodel0_.shape, ?)=true
WARN : SQL Error: 0, SQLState: 42883
ERROR: ERROR: function within(geometry, bytea) does not exist
Таким образом, кажется, что поле формы postgis является геометрией в порядке. (это тип геометрии postgis), но не понимает объект геометрии JTS. Я видел много вопросов об обратном, но не об этой ошибке.