Re: [GENERAL] hstore/jsonb support in hibernate/JPA

2014-07-27 Thread Craig Ringer
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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] hstore - jsonb

2014-04-04 Thread Oleg Bartunov
On Fri, Apr 4, 2014 at 12:20 PM, Armand Turpel
armand.turpel.m...@gmail.com wrote:
 Hi,

 A few questions about jsonb and hstore:

 1. does jsonb replace hstore?

no, it's different data type

 2. compatibility of jsonb  hstore?

hstore is a simple key-value model, while jsonb - richer  document-based model.

 3. will the development of hstore continue?

I don't believe so, we froze nested hstore to concentrate development
resources to jsonb.   Nested hstore still available from
http://www.sigaev.ru/git/gitweb.cgi?p=hstore.git;a=summary
It's should be compatible with 9.3


 4. is it recommended to use jsonb when planning new projects?

yes, we are working on jsonb support.


 Thanks
 Armand


 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] hstore - jsonb

2014-04-04 Thread Thom Brown
On 4 April 2014 13:04, Oleg Bartunov obartu...@gmail.com wrote:
 On Fri, Apr 4, 2014 at 12:20 PM, Armand Turpel
 armand.turpel.m...@gmail.com wrote:
 Hi,

 A few questions about jsonb and hstore:

 1. does jsonb replace hstore?

 no, it's different data type

 2. compatibility of jsonb  hstore?

 hstore is a simple key-value model, while jsonb - richer  document-based 
 model.

 3. will the development of hstore continue?

 I don't believe so, we froze nested hstore to concentrate development
 resources to jsonb.   Nested hstore still available from
 http://www.sigaev.ru/git/gitweb.cgi?p=hstore.git;a=summary
 It's should be compatible with 9.3


 4. is it recommended to use jsonb when planning new projects?

 yes, we are working on jsonb support.

One major advantage of hstore over json/jsonb at the moment is data
manipulation, which could make json/jsonb a non-starter for some.

For example, in hstore one can do:

-- remove a key/value pair by key
UPDATE mytable SET hcolumn = hcolumn - 'mykey'::text;

or:

-- remove a key/value pair by key/value
UPDATE mytable SET hcolumn = hcolumn - 'mykey=myvalue'::hstore;

or:

-- add/replace a key/value pair
UPDATE mytable SET hcolumn = hcolumn || 'newkey=newvalue'::hstore;


You can't do something like that with json/jsonb at the moment, and
that's not going to be possible in the upcoming version either.  You'd
probably have to resort to application-side modification, or use
something like pl/v8.

-- 
Thom


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] hstore - jsonb

2014-04-04 Thread Oleg Bartunov
We'll work on contrib/jsonxtra with all operators ported from hstore
and release it after 9.4 as separate extension.

On Fri, Apr 4, 2014 at 4:32 PM, Thom Brown t...@linux.com wrote:
 On 4 April 2014 13:04, Oleg Bartunov obartu...@gmail.com wrote:
 On Fri, Apr 4, 2014 at 12:20 PM, Armand Turpel
 armand.turpel.m...@gmail.com wrote:
 Hi,

 A few questions about jsonb and hstore:

 1. does jsonb replace hstore?

 no, it's different data type

 2. compatibility of jsonb  hstore?

 hstore is a simple key-value model, while jsonb - richer  document-based 
 model.

 3. will the development of hstore continue?

 I don't believe so, we froze nested hstore to concentrate development
 resources to jsonb.   Nested hstore still available from
 http://www.sigaev.ru/git/gitweb.cgi?p=hstore.git;a=summary
 It's should be compatible with 9.3


 4. is it recommended to use jsonb when planning new projects?

 yes, we are working on jsonb support.

 One major advantage of hstore over json/jsonb at the moment is data
 manipulation, which could make json/jsonb a non-starter for some.

 For example, in hstore one can do:

 -- remove a key/value pair by key
 UPDATE mytable SET hcolumn = hcolumn - 'mykey'::text;

 or:

 -- remove a key/value pair by key/value
 UPDATE mytable SET hcolumn = hcolumn - 'mykey=myvalue'::hstore;

 or:

 -- add/replace a key/value pair
 UPDATE mytable SET hcolumn = hcolumn || 'newkey=newvalue'::hstore;


 You can't do something like that with json/jsonb at the moment, and
 that's not going to be possible in the upcoming version either.  You'd
 probably have to resort to application-side modification, or use
 something like pl/v8.

 --
 Thom


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] hstore - jsonb

2014-04-04 Thread Thom Brown
On 4 April 2014 16:15, Oleg Bartunov obartu...@gmail.com wrote:
 We'll work on contrib/jsonxtra with all operators ported from hstore
 and release it after 9.4 as separate extension.

That would be useful. :)

Would there be an aim of getting that in-core for 9.5?

-- 
Thom


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] hstore - jsonb

2014-04-04 Thread Oleg Bartunov
On Fri, Apr 4, 2014 at 7:17 PM, Thom Brown t...@linux.com wrote:
 On 4 April 2014 16:15, Oleg Bartunov obartu...@gmail.com wrote:
 We'll work on contrib/jsonxtra with all operators ported from hstore
 and release it after 9.4 as separate extension.

 That would be useful. :)

 Would there be an aim of getting that in-core for 9.5?

I hope so.


 --
 Thom


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general