Data operation code is all about adding a record, deleting a record, and getting a single record. It will also help in scanning the table and listing all records.
Let's see how we can build our own function to perform various tasks:
public void addOneRecordToTable(String tableObjName, String rowKey, String colFamName, String columnName, String data) throws Exception { try { HTable tableObj = new HTable(configurationObj, tableObjName); Put put = new Put(Bytes.toBytes(rowKey)); put.add(Bytes.toBytes(colFamName), Bytes.toBytes(columnName), Bytes .toBytes(data)); tableObj.put(put); } catch (IOException exception) { exception.printStackTrace(); } } public void delRecordFromTable(String tableObjName, String rowKey) throws IOException { HTable tableObj = new HTable(configurationObj, tableObjName); List<Delete>list = new ArrayList<Delete>(); Delete delObj = new Delete(rowKey.getBytes()); list.add(delObj); tableObj.delete...