Re: json type

From: Mikko Tiihonen <mikko(dot)tiihonen(at)nitorcreations(dot)com>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: json type
Date: 2012-05-21 16:57:05
Message-ID: 4FBA73E1.5090106@nitorcreations.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 05/21/2012 11:18 AM, Craig Ringer wrote:
> On 05/10/2012 05:17 PM, Mikko Tiihonen wrote:
>> Hi,
>>
>> Here is a patch to enable initial support for hstore in the jdbc driver.
>>
>> With the patch using ResultSet.getObject() on a hstore column and it returns a HashMap<String, String>
>> Similarly a Statement.setObject(Map<Object,Object> will send the data to backend using hstore format.
>
> That's absolutely brilliant, thankyou!
>
> Of course, now there's a `json' type that folks will probably use much of the time instead, not least because it should be easier to work with from JDBC. I
> doubt it'll be as efficient and fast as hstore for single-level key/value info though.

Unfortunately there is no standard json type on java side so adding support for json to postgres jdbc is not straight forward.

I've been thinking that we could have a code that allows the postgres jdbc user to set the json class to use (gson, org.json, json-simple, jackson) and add some
reflection code into the jdbc driver to return path so that it works nicely. And of course the reverse reflection code for sending json to database.

-Mikko

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mikko Tiihonen 2012-05-21 18:55:39 hstore documentation
Previous Message Craig Ringer 2012-05-21 08:21:41 Re: Postgres JDBC, WS and commit