Artem thanks for taking time first. The entities in my case cannot be
annotated or changed so i am configuring them through XML (spring config),
as they're pregenerated from XSD schemas. But I've partially solved the
problem now i got a different issue, I've altered your example to:
==============
public static class ProductSpecification implements Serializable
{
private static final long serialVersionUID = 0;
@QuerySqlField
private String id;
@QuerySqlField
private CatalogValue characteristic;
public ProductSpecification (String id, CatalogValue characteristic)
{
this.id = id;
this.characteristic = characteristic;
}
}
public static class CatalogValue implements Serializable
{
private static final long serialVersionUID = 0;
@QuerySqlField (index = true)
private int id;
private String name;
public CatalogValue (int id, String name)
{
this.id = id;
this.name = name;
}
}
@Test
public void test2 ()
{
IgniteConfiguration cfg = new IgniteConfiguration ();
System.getProperties ().put ("IGNITE_H2_DEBUG_CONSOLE", "true");
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<?>> q = c.query (new SqlFieldsQuery ("select id from
ProductSpecification ps where catalogId > 10"));
for (List<?> objects : q)
System.out.println (objects);
}
}
==============
As you can see the CatalogValue now has "id" named field. as does parent
class. Now the problem is with indexes names / field names as they are
duplicate.
Error:
class org.apache.ignite.IgniteCheckedException: Property with name 'id'
already exists.
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Indexing-Querying-of-child-element-fields-tp1704p1734.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.