How to store Primitive Datatypes , Strings in a HBase Column and Retrieve Them. Normally when we want to store data in HBase table we do as below.
Configuration conf = HBaseConfiguration.create();
HTable table = new HTable(conf, "people");
Put put = new Put(Bytes.toBytes("doe-john-m-12345"));
put.add(Bytes.toBytes("personal"), Bytes.toBytes("givenName"), Bytes.toBytes("John"));
put.add(Bytes.toBytes("personal"), Bytes.toBytes("mi"), Bytes.toBytes("M"));
put.add(Bytes.toBytes("personal"), Bytes.toBytes("surame"), Bytes.toBytes("Doe"));
put.add(Bytes.toBytes("contactinfo"), Bytes.toBytes("email"), Bytes.toBytes("john.m.doe@gmail.com"));
table.put(put);
table.flushCommits();
table.close();
My question is how to Store Primitive data types in HBase including Strings and How to retrieve them using serialization and derialization. I'm really new to HBase and please give me a clear steps to get this job done.
check out my answer here
You can use
Bytes
inorg.apache.hadoop.hbase.util
like: