Class CacheQueryExample


  • public class CacheQueryExample
    extends java.lang.Object
    Cache queries example. This example demonstrates TEXT, FULL SCAN and INDEX queries over cache.

    Example also demonstrates usage of fields queries that return only required fields instead of whole key-value pairs. When fields queries are distributed across several nodes, they may not work as expected. Keep in mind following limitations (not applied if data is queried from one node only):

    • Non-distributed joins will work correctly only if joined objects are stored in collocated mode. Refer to AffinityKey javadoc for more details.

      To use distributed joins it is necessary to set query 'distributedJoin' flag using SqlFieldsQuery.setDistributedJoins(boolean).

    • Note that if you created query on to replicated cache, all data will be queried only on one node, not depending on what caches participate in the query (some data from partitioned cache can be lost). And visa versa, if you created it on partitioned cache, data from replicated caches will be duplicated.

    Remote nodes should be started using ExampleNodeStartup which will start node with examples/config/example-ignite.xml configuration.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)
      Executes example.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CacheQueryExample

        public CacheQueryExample()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Executes example.
        Parameters:
        args - Command line arguments, none required.
        Throws:
        java.lang.Exception - If example execution failed.