博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java操作HBase
阅读量:3943 次
发布时间:2019-05-24

本文共 1162 字,大约阅读时间需要 3 分钟。

rowkey查询

//根据rowKey进行查询    public static User getDataByRowKey(String tableName, String rowKey,String password) throws IOException {
Admin admin = connection.getAdmin(); Table table = connection.getTable(TableName.valueOf(tableName)); Get get = new Get(rowKey.getBytes()); User user = new User(); user.setName(rowKey); //先判断是否有此条数据 if(!get.isCheckExistenceOnly()){
Result result = table.get(get); Cell[] cells = result.rawCells(); for ( Cell cell : cells){
String colName = Bytes.toString(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); String value = Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); System.out.println(" ========= "+colName); System.out.println("=========" + value); if(colName.equals("pwd")){
user.setPwd(value); } if (colName.equals("email")){
user.setEmail(value); } } } return user; }

转载地址:http://xeawi.baihongyu.com/

你可能感兴趣的文章
Determining and Monitoring the Connectivity Status 根据网络连接状况去省电
查看>>
Manipulating Broadcast Receivers On Demand 按需操控广播接收
查看>>
Creating a View Class 创建一个视图类
查看>>
Custom Drawing 自定义绘制
查看>>
Making the View Interactive 视图互动
查看>>
Optimizing the View 优化视图
查看>>
Setting Up the Search Interface 设置搜索界面
查看>>
Storing and Searching for Data 数据存储和搜索
查看>>
Remaining Backward Compatible 保持向后兼容
查看>>
Remembering Your User 记住你的用户
查看>>
Authenticating to OAuth2 Services 验证OAuth2服务
查看>>
Creating a Custom Account Type 创建自定义帐户类型
查看>>
Sending Content to Other Apps 将内容发送到其他应用程序
查看>>
Receiving Content from Other Apps 接收来自其他应用程序的内容
查看>>
Adding an Easy Share Action 添加一个简单的共享行动
查看>>
Taking Photos Simply 简单地拍摄照片
查看>>
Recording Videos Simply 简单录制视频
查看>>
Controlling the Camera 控制相机
查看>>
Creating Multiple APKs for Different API Levels 创建多个不同的API级别的APK
查看>>
Creating Multiple APKs for Different Screen Sizes 创建多个APKs为不同的屏幕尺寸
查看>>