Re: hstore/jsonb support in hibernate/JPA - Mailing list pgsql-general

From Craig Ringer
Subject Re: hstore/jsonb support in hibernate/JPA
Date
Msg-id 53D5C067.40100@2ndquadrant.com
Whole thread Raw
In response to hstore/jsonb support in hibernate/JPA  (Martin Gudmundsson <martingudmundsson@gmail.com>)
List pgsql-general
On 07/22/2014 07:10 PM, Martin Gudmundsson wrote:
> Hi all!
> I saw that Rails 4 comes with hstore support out of the box.
>
> Does anyone know if there’s any integrated support like that in hibernate or any other JPA implementation?
> I know your able to write your own custom datatypes, but I’m looking for integrated standardized support in the base
library.

I haven't seen any JPA providers with built-in support for hstore.

Unfortunately there's also no type extension SPI for JPA, so the is no
standard way to provide extension types that don't depend directly on a
particular JPA provider's guts. Frankly I think the concept of JPA for
fully provider-independent portable dev is a waste of time for anything
except toy apps or very small databases - anything real generally needs
per-query fetch control and other things JPA just doesn't provide for.

I suggest picking a provider and sticking to it.

If you're developing a new app, rather than targeting hstore, consider
starting work with PostgreSQL 9.4 (currently in beta-2) and using the
jsonb type. That way you can use the numerous good quality json tools in
Java to map json to/from Java objects or manipulate json trees, while
saving them to the DB and loading them from the DB as native json fields.

If you use hstore, you'll have to write the equivalent yourself or crib
from someone else. So why not start on the right foot and go straight
for jsonb?

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-general by date:

Previous
From: klo uo
Date:
Subject: Re: Calltips in pgAdmin SQL Editor
Next
From: François Beausoleil
Date:
Subject: Pairwise array sum aggregate function?