Migrate from earlier HBase versions
The Cloud Bigtable HBase client for Java targets versions 1.x and 2.x of theApache HBase API. Version 1.0 of the API included some notablechanges from earlier versions of HBase. If you are migrating toBigtable from HBase, and your application targets an older versionof the HBase API, you will need to update your application to make it compatiblewith Bigtable.
To assist with your migration, this page summarizes the most notable changes inthe HBase 1.0 API.
Connection interface
In HBase 1.0 and later, instead of relying upon the deprecatedHConnectioninterface, you should useorg.apache.hadoop.hbase.client.ConnectionFactory.This class creates objects that implement the newConnectioninterface.ConnectionFactory replaces the deprecatedclassesConnectionManager andHConnectionManager.
Creating aConnection object is a relatively expensive operation. You shouldcreate oneConnection object per process and share the object as needed.Connection objects are thread-safe.
In addition, be sure to close the connection once you are done using it. InHBase 1.0 and later, it is the application's responsibility to manage thelifecycle of the connection.
Your updated code should look similar to the following example:
Connection connection = ConnectionFactory.createConnection(config);// ...connection.close();TableName class
In previous versions of HBase, when you manipulated a table, you could specifythe table name as aString orbyte[] value. In HBase 1.0 and later, you mustspecify the table name by creating an instance oforg.apache.hadoop.hbase.TableName:
String tableName = "MyTable"; // or byte[] tableName = Bytes.toBytes("MyTable");TableName tableNameObj = TableName.valueOf(tableName);Table, BufferedMutator, and RegionLocator interfaces
In HBase 1.0, theHTable class is replaced by the following interfaces:
org.apache.hadoop.hbase.client.Table: Enables you to workwith data in a single table.org.apache.hadoop.hbase.client.BufferedMutator:Enables you to perform asynchronous batch writes to a table. Use this classinstead of calling thesetAutoFlush(boolean)method inHTableInterface.org.apache.hadoop.hbase.client.RegionLocator:Provides access to information about a table's regions.
new HTable(config) to access Bigtable.Use aConnection object to obtain an instance of these interfaces:
Tabletable=connection.getTable(tableNameObj);BufferedMutatormutator=connection.getBufferedMutator(tableNameObj);RegionLocatorregionLocator=connection.getRegionLocator(tableNameObj);Instances ofTable,BufferedMutator, andRegionLocator are notthread-safe. However, these are lightweight objects, so you can create them asneeded within the context of a single thread.
Admin interface
In HBase 1.0, theHBaseAdmin class is replaced by theorg.apache.hadoop.hbase.client.Admin interface. BecauseBigtable handles maintenance tasks automatically, many of themethods in theAdmin interface are not supported. SeeDifferences between theHBase and Bigtable APIs for details.
new HBaseAdmin(config) to access Bigtable.Use aConnection object to obtain an instance of theAdmin interface:
Admin admin = connection.getAdmin();Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.