Ok, got it.

Next example demostrate what you want.

Note, ProductSpecification.name annotated as QuerySqlField it's not required
and done for example purposes.

   public static void main(String[] args) {
        IgniteConfiguration cfg = new IgniteConfiguration();

        try (Ignite ignite = Ignition.start(cfg)) {
            CacheConfiguration<Integer, ProductSpecification> cc = new
CacheConfiguration<>("productSpecifications");

            cc.setIndexedTypes(
                Integer.class, ProductSpecification.class
            );

            IgniteCache<Integer, ProductSpecification> c =
ignite.getOrCreateCache(cc);

            CatalogValue v1 = new CatalogValue(13, "Catalog 13");
            CatalogValue v2 = new CatalogValue(-317, "Catalog -317");

            c.put(1, new ProductSpecification("spec1", v1));
            c.put(2, new ProductSpecification("spec2", v2));
            c.put(3, new ProductSpecification("spec3", v1));

            QueryCursor<List&lt;?>> q = c.query(
                new SqlFieldsQuery("select name from ProductSpecification ps
where catalogId > 10"));

            for (List<?> objects : q)
                System.out.println(objects);
        }
    }

    public static class ProductSpecification implements Serializable {
        private static final long serialVersionUID = 0;

        @QuerySqlField
        private String name;

        @QuerySqlField
        private CatalogValue characteristic;

        public ProductSpecification(String name,
            CatalogValue characteristic) {
            this.name = name;
            this.characteristic = characteristic;
        }
    }

    public static class CatalogValue implements Serializable {
        private static final long serialVersionUID = 0;

        @QuerySqlField(index = true)
        private int catalogId;

        private String name;

        public CatalogValue(int catalogId, String name) {
            this.catalogId = catalogId;
            this.name = name;
        }
    }



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Indexing-Querying-of-child-element-fields-tp1704p1722.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to