Search code examples
javapostgresqlpostgismybatis

Java with MyBatis postgreql postgis query - type geometry does not exist error


I am running spring boot 2 and myBatis with postgresql. I installed postgis extension in my db. When running query from my app - I get error:

PSQLException: error: type "geometry" does not exist.

Running the same query in PGAdmin - I get the results, it means the extension installed successfully. When running the query from Java without geometry param - also success. This is the query from mybatis:

"<select id="selectMyFilters" parameterType="map" resultType="FilterOptions">
select ${column} as value,
from myFilters where 
${column} is not null 
<if test="geometry != null">
and (
<![CDATA]
ST_WITHIN (myGeo :: geometry, ST_SETSRID(ST_GeomFromGeoJSON('${geometry}'),4326))
GROUP BY ${column};
</select>"

MyGeo column also has been defined in db as GEOGRAPHY(POINTZ,4326)

I spent on it 2 days already but cannot find the problem.

Anybody can help?


Solution

  • add to search path the public scheme, (in addition to the scheme that you fetch data from) because the gis is installed in the public scheme