As I said in your other thread, you need to think in relational terms. That is, 
you need to normalise the data. Then your query would just be a join/filter 
against the CacheNameType table.

You could do that as you feed the data in. You could do it using something like 
a ContinuousQuery to update the child tables dynamically.

> On 4 Jun 2021, at 08:05, Taner Ilyazov <taner.ilya...@gmail.com> wrote:
> 
> We need to be able to filter based on CacheName.nestedClass.types -> example 
> CacheName.nestedClass.types.contains("firstType)
> and filter on CacheName.nestedClass.dynamicFields.thirdKey.greaterThan(0L).
> DynamicFields values consist of custom implementations of Long, String, Date 
> wrappers.
> 
> Filtering as needed works with ScanQueries, but we need to be able to order 
> the results by the same fields.
> 
> With specifying QueryEntities using XML I've managed to get the results 
> mapped into a POJO with a SqlFieldsQuery like: "select * from CacheName", but 
> I can't specify the nested fields using SQL like "select nestedClass.type 
> from QueryEntities" or  "select type from QueryEntities".
> Without specifying as so we can't filter or order based on those properties.
> 
> <bean class="org.apache.ignite.configuration.CacheConfiguration">
>     <property name="name" value="CacheName"/>
>     <!-- Configure query entities -->
>     <property name="queryEntities">
>         <list>
>             <bean class="org.apache.ignite.cache.QueryEntity">
>                 <!-- Setting  the type of the key -->
>                 <property name="keyType" value="java.lang.Long"/>
> 
>                 <property name="keyFieldName" value="id"/>
> 
>                 <!-- Setting type of the value -->
>                 <property name="valueType" 
> value="com.tanerilyazov.test.CacheName"/>
> 
>                 <!-- Defining fields that will be either indexed or queryable.
>                      Indexed fields are added to the 'indexes' list below.-->
>                 <property name="fields">
>                     <map>
>                         <entry key="id" value="java.lang.Long"/>
>                         <entry key="nestedClass.type" value="java.util.List"/>
>                         <entry key="nestedClass.dynamicFields" 
> value="java.util.Map"/>
>                     </map>
>                 </property>
> 
> On Fri, 4 Jun 2021 at 09:54, Taner Ilyazov <taner.ilya...@gmail.com 
> <mailto:taner.ilya...@gmail.com>> wrote:
> Hello everyone, I'm trying to find a solution for the current case:
> 
> I have generated classes, which can't be changed.
> 
> public static class CacheName {
>     private Long id;
>     private NestedClass nestedClass;
> }
> 
> public static class NestedClass {
>     private List<String> types;
>     private Map<String, Object> dynamicFields;
> }
> 


Reply via email to