Database Reference
In-Depth Information
Some of the other important methods deined in the Get class are stated in the
following table:
Method name
Description
getFamilyMap()
Method for retrieving the get method's
family map
getMaxResultsPerColumnFamily()
Method for retrieving the get method's
maximum number of values to return per
column family
getCacheBlocks()
Gets whether blocks should be cached for
this method
Updating data
Data updation in HBase is done in a manner that is similar to writing it. The new
data is updated in the table using a Put instance. The following is the sample code
for updating data in HBase:
// Get instance of Default Configuration
Configuration conf = HBaseConfiguration.create();
//Get table instance
HTable table = new HTable(conf, "tab1");
// Create Put with rowkey
Put put = new Put(Bytes.toBytes("row-1"));
// Update a column with value "Hello", in "cf1:greet", to the
// Put.
put.add(Bytes.toBytes("cf1"), Bytes.toBytes("greet"),
Bytes.toBytes("GoodMorning"));
// Update more column with value "David", in "cf1:person", to the //
Put.
put.add(Bytes.toBytes("cf1"), Bytes.toBytes("person"),
Bytes.toBytes("David"));
table.put(put);
table.close();
Search WWH ::




Custom Search