https://kotlinlang.org logo
Title
d

Dennis Tel

05/27/2021, 2:02 PM
Hi! Is there a good persistence library (preferably a Kotlin one) for working with postgres’s json columns?
👀 1
h

hho

05/27/2021, 2:17 PM
People (full disclosure: not me) seem to have used #exposed for that, even though it's not yet officially supported: https://github.com/JetBrains/Exposed/issues/127
c

cdpjenkins

05/27/2021, 2:19 PM
What precisely are you looking for? I’m using JDBI and it seems to be doing a decent job of serialising/deserialising instances of Kotlin data classes into JSON/JSONB columns… but I’m guessing you might be looking for something more than that…
d

Dennis Tel

05/27/2021, 2:20 PM
serialize/deserialize and some form of (basic) querying
and its a plus if its officially supported
What made you guess i’m looking for more 😄?
c

cdpjenkins

05/27/2021, 2:24 PM
I definitely recommend checking out JDBI then. It’s a fairly thin wrapper over JDBC which I’ve only just started playing with but it seems to just work and I like it a lot. And the JSON stuff has worked well for me (even though I feel like I’m not doing much with it… just serialising/deserialising to/from Postgres JSON/JSONB column).
👍 1
(I haven’t tried queries on fields in JSON objects but I assume that’ll work OK as well because that’s handled by the DB and not the library.)