How to Query your Custom Objects in Collections Stored in Regions
search cancel

How to Query your Custom Objects in Collections Stored in Regions

book

Article ID: 293967

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

At times, your use-case may require you to put Java Collection objects (such as an ArrayList, or HashSet, or similar) into your GemFire regions. Moreover, those Collection objects may contain multiple custom objects. This article provides information on how to query such custom objects contained within a Collection object stored in your regions.


Resolution

You can find several query examples in the GemFire documentation. You can query your custom objects contained within a Collection stored in a GemFire region by applying one of the two techniques used in the following query examples:

Querying nested collections, e.g.:SELECT val FROM /YourRegion.entrySet ent, ent.value val WHERE val.id = 101

Using Region Entry Keys and Values, e.g.:SELECT val FROM /YourRegion.entries ent, ent.value val WHERE val.id = 1