Re: Postgresql 9.4 / JSONB / JDBC - Mailing list pgsql-jdbc

From Alexis Meneses
Subject Re: Postgresql 9.4 / JSONB / JDBC
Date
Msg-id CANPkoZTtQYpmgZT+fSeZc2+sOmYtzwYRBrDU_bKJ5FyVUSFEDQ@mail.gmail.com
Whole thread Raw
In response to Re: Postgresql 9.4 / JSONB / JDBC  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: Postgresql 9.4 / JSONB / JDBC  (Bosco Rama <postgres@boscorama.com>)
List 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@fastcrypt.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@reflexe.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

pgsql-jdbc by date:

Previous
From: Mo Omer
Date:
Subject: Re: Postgresql 9.4 / JSONB / JDBC
Next
From: Alexis Meneses
Date:
Subject: Re: Postgresql 9.4 / JSONB / JDBC