Search code examples
postgresqlscalascalikejdbc

Is there an example of using an hstore data structure with scalikejdbc and postgres?


We have a use case where using an hstore data structure inside a table would be very helpful for solving a problem with our current data model. Our current setup is with postgres and scalikejdbc. The problem is that there seems to be no documentation on how this would be done, though indications are that it is supported with the latest JDBC drivers.

Are there any examples of using a hstore data type with postgres and scalikejdbc?


Solution

  • The following QA tells using ResultSet#getObject and then doing typecasting.

    How to use PostgreSQL hstore/json with jdbctemplate

    Although I've never actually tried it, WrappedResultSet#any("hstore_column").asInstanceOf[java.util.Map[String, String]] or similar should work for you.