Hibernate SpatialRestrictions 和 PostGIS 别名:'column does not exist'
Hibernate SpatialRestrictions & PostGIS alias: 'column does not exist'
当我从 SpatialRestrictions
(例如 SpatialRestrictions.intersects(propertyName, geometryObj)
)指定标准时,生成的 SQL 无效,因为列名已被别名使用且使用不正确:
生成SQL
SELECT this_.GEO_LOCATION as y10_
FROM schema.GEO this_
WHERE ( ST_intersects(y10_, 'SRID=4326;POLYGON(...)')
OR ST_intersects(y10_, 'SRID=4326;POLYGON(...)'))
有没有办法强制忽略投影别名而只使用 table_alias.column
?
我通过将 "this." + propertyName
传递给 SpatialRestriction
解决了这个问题。
当我从 SpatialRestrictions
(例如 SpatialRestrictions.intersects(propertyName, geometryObj)
)指定标准时,生成的 SQL 无效,因为列名已被别名使用且使用不正确:
生成SQL
SELECT this_.GEO_LOCATION as y10_
FROM schema.GEO this_
WHERE ( ST_intersects(y10_, 'SRID=4326;POLYGON(...)')
OR ST_intersects(y10_, 'SRID=4326;POLYGON(...)'))
有没有办法强制忽略投影别名而只使用 table_alias.column
?
我通过将 "this." + propertyName
传递给 SpatialRestriction
解决了这个问题。