From: | Alban Hertroys <haramrae(at)gmail(dot)com> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to retrieve jsonb column through JDBC |
Date: | 2016-08-29 22:39:59 |
Message-ID: | 47F8D0CB-C635-4BDB-87DF-CC6823346A4A@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On 29 Aug 2016, at 20:23, Alexander Farber <alexander(dot)farber(at)gmail(dot)com> wrote:
> On Mon, Aug 29, 2016 at 7:50 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Sat, Aug 27, 2016 at 5:39 AM, Alexander Farber
> <alexander(dot)farber(at)gmail(dot)com> wrote:
> >
> > List last_tiles = (List) JSON.parse(rs.getString("last_tiles"));
> >
> > has not work for me even though the string is:
> >
> > [{"col": 7, "row": 8, "value": 1, "letter": "A"}, {"col": 7, "row": 7,
> > "value": 2, "letter": "B"}, {"col": 7, "row": 9, "value": 2, "letter": "C"}]
> >
> > but it is probably the problem of the Jetty class I am using and not of
> > JDBC...
>
> huh. what exactly is failing? are you getting a parse exception?
>
> http://download.eclipse.org/jetty/9.3.11.v20160721/apidocs/org/eclipse/jetty/util/ajax/JSON.html#parse-java.lang.String-
>
> fails with:
>
> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.List
I'm not 100% sure it's the root of the ClassCastException here, but I'm pretty sure that Java will want to know what class of items that List consists of.
If that doesn't ring a bell for you, spend some time reading about "Java generic classes" (not to be confused with "general Java classes").
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.
From | Date | Subject | |
---|---|---|---|
Next Message | Nicolas Grilly | 2016-08-30 11:10:07 | Clustered index to preserve data locality in a multitenant application? |
Previous Message | Alvaro Herrera | 2016-08-29 18:58:19 | Re: Any work on better parallelization of pg_dump? |