Thanks for the feedback Stack!
So you suggest to just serialize the JSON represent as a String or as a Map?
Something like this:
(supposing item is a String or a Map)
Put row = new Put(Bytes.toBytes(item.id))
row.add(Bytes.toBytes("json"), Bytes.toBytes("1"), Bytes.toBytes(item))
table.put(row)
What should I use as qualifier in this case?
Is this way the json efficiently persisted?
HBase does not offer a Map serializer? Should I use
myObjectOutputStream.writeObject(map) ?
Thanks again,
Pablo
On Mon, Jan 31, 2011 at 4:48 PM, Stack <[email protected]> wrote:
> Don't use MapWritable.
>
> In the layer above HBase, inside whatever is hosting the HBase client,
> serialize the JSON to bytes and then write that to an HBase cell. In
> the same layer, reading, do the deserializations.
>
> HBase only does byte arrays.
>
> St.Ack
>
>
> On Mon, Jan 31, 2011 at 11:30 AM, Pablo Molnar <[email protected]>
> wrote:
> > Hi everyone,
> >
> > In my company we are experimenting with HBase and I'd like to know the
> best
> > way to persist a semi-structured complex (3 levels) entity represented as
> > JSON to HBase.
> > I've already done successfully a Java client that persist rows in a table
> > and now my target is persist this JSON.
> >
> > I've looked through the api and found a MapWritable class that could be
> > usefull because for me is very easy to convert the JSON enitity into a
> Map
> > and then persist it.
> >
> > I really appreciate some example how I could implement this
> > If this is possible my next concerns would be how about if I want to
> create
> > and index by a key (of the Map)?
> >
> > Thanks in advance,
> > Pablo Molnar
> >
>