Using row metadata in Read Operations
You can retrieve the user-defined row metadata with the help of APIs below. For more information, see Using user-defined row metadata
Note:
This feature has been made available to you on a "preview" basis so that you can get early access and provide feedback. It is intended for demonstration and preliminary use only. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to this feature and will not be responsible for any loss, costs, or damages incurred due to the use of this feature.- GetRequest API: You can use the
GetRequest
API to retrieve the row metadata of a single row. After executing theGetRequest
API to retrieve the row, given a table name and primary key, you can retrieve the row metadata by calling thegetRowMetadata()
method. The operation returns aGetResult
object that contains the retrieved data. If no metadata exists, it returns null.See thereadRowMetadata()
in ManageMetadata.java for more details, available in the examples here./*Method to fetch a row-metadata using GET API*/ private static void readRowMetadata(NoSQLHandle handle, int acctId) throws Exception { GetRequest gr = new GetRequest() .setKey(new MapValue().put("acct_Id", acctId)) //key of the row to fetch .setTableName(tableName); //table name GetResult gres = handle.get(gr); String rm= gres.getRowMetadata(); if (rm != null) { System.out.println("Row metadata for acct_Id " + acctId + ": " + rm); } else { System.out.println("No metadata found for acct_Id " + acctId); } }
- QueryRequest API: You can write a SQL
SELECT
statement using theQueryRequest
API to explicitly fetch row metadata. This allows metadata to be returned as part of the result set. It's especially helpful when you want to view metadata across multiple rows for data clarification or analysis purposes. See thereadAllRowMetadataViaQuery()
in ManageMetadata.java for more details, available in the examples here.