Hbase stores data in column format. Each entry must have a unique key. Subsections can be created on the fly, but not the main columns.
For example, specify this xml.
<X1> <X2 name = "uniqueid">1</X2> <X3> <X4>value1</X4> <X5>value2</X5> <X6> <X7>value3</X7> <X8>value4</X8> </X6> </X3> <X7>value5</X7> </X1>
In this case, the main column family will be X3 and X7. The string identifier can be taken from X2. You can build an Hbase entry equivalent to this using java api like,
Put p = new Put("/*put the unique row id */ ".getBytes() ); p.add("X3".getBytes(), "X4".getBytes(), value1.getBytes());
where the first argument is the column family and the second is the column identifier (below the column).
You can also use 2 argument constructors, for example,
p.add("X3:X6:X7".getBytes(),value3);
then table.put(p) . Here it is!!!
source share