Skip to content

Extended java.util.HashMap with FHstorable #6

wants to merge 2 commits into from

2 participants

dcj commented Apr 14, 2013

Hello @blakesmith (and @citizenparker)

Wow, I was so happy to find this library!
I tried to use it, but ran into issues. The writes into the DB worked fine,
but the read path back from Postgres -> JDBC -> Korma -> pghstore didn't work.
Somehow, what was getting passed to from-hstore was a java.util.HashMap, not a
org.postgresql.util.PGobject, so no implementation of from-hstore was found for java.util.HashMap.

Has there been a change with one or more "links in the chain" above?

I am running:
Clojure 1.5.1,
Postgres 9.2.x,

[org.clojure/java.jdbc "0.2.3"]
[postgresql "9.2-1002.jdbc4"]
[korma "0.3.0-RC5"]

Anyway, I didn't take the time to really dig into this to understand what the issue was.
I simply threw together a very quick and dirty implementation of from-hstore for java.util.HashMap, which is here in my pull request, just FYI. I'm not claiming my code is the best or right way to do this, if in fact this needs to be done at all...

I'm pretty sure I am unblocked for now, but it would be great to get some more knowledgeable perspective from you guys on this....

Thanks !


@dcj Hmm, can you post the code from Korma that was calling from-hstore? That seems very odd. I've used it in environments identical to yours but for the Clojure version with no problem.

dcj commented Apr 14, 2013


I define my entities like this:

(:use korma.core

(defentity businesses
(table :businesses)
(prepare #(update-in % [:details] to-hstore))
(transform #(update-in % [:details] from-hstore))
(prepare #(update-in % [:location] to-hstore))
(transform #(update-in % [:location] from-hstore)))

I then 'use this file/namespace in another file/namespace where I define a number of functions for interacting with
this DB table:

(:require [korma.core :as korma]

And here I define functions like "create", "read", and update for my table.

Then in other code, I require this filem

(:require [ :as business])

And then call things like

(business/create some-clojure-map)

If this is not enough info to understand why I am having this issue, I can create a small test repo/app
to attempt to reproduce the issue in a small example....

Donald Clark Jackson Can't remember :-( 71cf9ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.