Re: Postgresql 9.4 / JSONB / JDBC

From: Alexis Meneses <alexis(dot)meneses(at)gmail(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Christopher BROWN <brown(at)reflexe(dot)fr>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Postgresql 9.4 / JSONB / JDBC
Date: 2014-12-20 14:18:58
Message-ID: CANPkoZTtQYpmgZT+fSeZc2+sOmYtzwYRBrDU_bKJ5FyVUSFEDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Christopher,

I already started to think about something to add the ability to use JSON
objects with pgjdbc to meet Postgresql 9.4 major features on jdbc side
(setObject/getObject).

IMO, the JSON API that should be used is javax.json (
http://docs.oracle.com/javaee/7/api/javax/json/package-summary.html)
because I think we should stick to standard APIs in the jdbc driver.
Many JSON implementations other that the default one can be used behind
this API thanks to Java ServiceLoader API even if I believe that the widely
used Jackson does not provide a bridge between javax.json and their
implementation.

Anyway, as javax.json is not in Java SE, I think we may have to create an
extensible way of managing the mapping from Java Object to Postgresql OID
and structures. Loading the javax.json mapper could be done accordingly to
what is available in the JVM pgjdbc is running in.
That way, one could also provide its own custom mapping implementations to
the driver to handle any kind of custom object (Jackson objects could be
handled by 3rd parties that way).

Alexis Meneses

2014-12-20 13:19 GMT+01:00 Dave Cramer <pg(at)fastcrypt(dot)com>:

> Christopher,
>
> No you have not missed anything, there has been nothing done with jsonb
> and the driver. Since you are the first, perhaps you can give me your wish
> list ?
>
> What would you like to see happen ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> On 20 December 2014 at 04:44, Christopher BROWN <brown(at)reflexe(dot)fr> wrote:
>>
>> Hello,
>>
>> I'm new to this list, and have tried searching both the mailing list
>> archives, and internet in general, for information on how to use the new
>> JSONB data type with JDBC. Found almost nothing in the mailing list
>> archives, and internet searches "helpfully" assume I've misspelled "json"
>> and give me results that are unrelated or refer to the basic "JSON" type
>> from older Postgresql versions.
>>
>> How can this type be used, with simple "flat" key-value collections
>> (maps), with tree-like maps-of-maps, and (ideally) with JSON APIs such as
>> Jackson JSON API?
>>
>> Is it possible? Is it already described somewhere that I missed?
>>
>> Thanks,
>> Christopher
>>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mo Omer 2014-12-20 16:10:43 Re: Postgresql 9.4 / JSONB / JDBC
Previous Message Christopher BROWN 2014-12-20 14:14:21 Re: Postgresql 9.4 / JSONB / JDBC