Search code examples
gridgain

GridGain: inheritance in the SQL query


Is it possible to perform queries using parent class in GridGain? Let say I have Person class and it's descendant CustomPerson. If I put both type of objects in the same cache will I be able to run a query like

GridCacheQuery<Map.Entry<Long, Party>> qry = queries.createSqlQuery(Person.class, "from Person");

expecting all the objects in the result set?


Solution

  • No, for GridGain they are just two different classes and thus put into two different SQL tables.

    I'd suggest to use UNION ALL query like

    select _val from Person where age = ?
    union all
    select _val from CustomPerson where age = ?