此内容没有您所选择的语言版本。
3.4. Querying Example
The following provides an example of how to set up and run a query in Red Hat JBoss Data Grid.
In this example, the
Person
object has been annotated using the following:
Assuming several of these
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
Person
objects have been stored in JBoss DataGrid, they can be searched using querying. The following code creates a SearchManager
and QueryBuilder
instance:
The
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
SearchManager
and QueryBuilder
are used to construct a Lucene query. The Lucene query is then passed to the SearchManager
to obtain a CacheQuery
instance:
This
CacheQuery
instance contains the results of the query, and can be used to produce a list or it can be used for repeat queries.