0

I'm trying to use the PostGIS-JDBC-jtsparser (version 2.5.0) module to inject the JTS java object as a parameter of a @SQLQuery but I can't figure out how.
I understand that an argument factory should be injected in my JDBI config but which one?
If that's not the right approach, then what would be the best one?

! org.jdbi.v3.core.statement.UnableToCreateStatementException: No argument factory registered for 'POLYGON ((-10 -10, -10 10, 10 10, 10 -10, -10 -10))' of qualified type org.locationtech.jts.geom.Polygon [statement:"/* DataDao.dateHistogramAsIterable */ select st_geohash(mygeo,1) as geohash_0_key,count(mygeo) as geohash_0_count from myindex  where (st_coveredby(mygeo,:0))  group by rollup (geohash_0_key)  ", arguments:{positional:{}, named:{0:POLYGON ((-10 -10, -10 10, 10 10, 10 -10, -10 -10))}, finder:[]}]
! at org.jdbi.v3.core.statement.ArgumentBinder.factoryNotFound(ArgumentBinder.java:174)
Pritom Sarkar
  • 2,154
  • 3
  • 11
  • 26
Alain B.
  • 100
  • 1
  • 5
  • Have you checked the JDBI PostgresPlugin (http://jdbi.org/#_postgresql)? It might contain relevant argument factories or at least give a hint how to write your own if the class you try insert is custom. – Yurii Melnychuk Feb 24 '21 at 20:54
  • I did load the PostgresPlugin but nothing related to geometries in there. So you suggest I write my own plugin and argument factories? I was expecting not to be the first one to ever need this feature. – Alain B. Feb 25 '21 at 11:03
  • JDBI is not designed to satisfy all the possible needs of every developer, so Postgres support can be limited to only the most used custom data types. `Polygon` may be not one of them. – Yurii Melnychuk Feb 25 '21 at 11:38
  • I was expecting PostGIS-JDBC-jtsparser module to be of some use but I guess JDBI is not able to leverage the class injection done in there. I'll continue searching. Thanks – Alain B. Feb 25 '21 at 13:04

0 Answers0