CRUD操作,crud
CRUD操作,crud
简单的CRUD操作,参考HBase权威指南(中文版).pdf,下面的是对HBase基本操作进行面向对象封装后的CRUD操作。所有以HBase作为存储数据库的DAO层,都继承HBaseDaoImpl类,下列是使用示例。 新增操作 public String add(XControl control) throws Exception { String id = HBaseRowKeyUtil.getRowKey(controlTableName); control.setId(id); control.setStatus(Status.ADD.getValue()); PutDeletepd=HBaseConvetorUtil.convetor(control,id); super.savePutDelete(controlTableName, pd); return id; 更新操作 public String update(XControl control) throws Exception { String id = control.getId(); PutDelete pd=HBaseConvetorUtil.convetor(control,id); super.savePutDelete(controlTableName, pd); return id; } 查询操作 public XControl getXControl(String id) throws Exception { return super.get(XControl.class,controlTableName, id); } 删除操作 public void delete(String id) throws IOException { delete(controlTableName, id); } |
更多精彩内容请关注:http://bbs.superwu.cn
关注超人学院微信二维码:
评论暂时关闭