You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by zshamrock <al...@gmail.com> on 2016/08/14 22:29:26 UTC

SqlQuery on hierarchy of classes doesn't work

I have a simple hierarchy: Location abstract class, and PlayerLocation and
BallLocation extensions of the parent abstract class Location.

If I do SQL query for the `cache<String, Location>`, nothing is returned
back (even though the cache.size() eq to 5). Same true in H2 console -
trying to query for * entries returns empty resultset (even doing new
`SqlQuery<>(Location.class, "1 == 1");` returns empty list back.

Although if I change everything to use the concrete class PlayerLocation,
everything then works like expected, I can query entries from H2, get the
expected resultset from Java code, etc.

So, is it possible still to declare cache storing the parent abstract class,
and story any of its children, and do query on later on it? Is there the way
to enable it, or it is just simply not supported, and I have to use 2 caches
instead - one for player, and one for ball locations, which is not perfect.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/SqlQuery-on-hierarchy-of-classes-doesn-t-work-tp7049.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: SqlQuery on hierarchy of classes doesn't work

Posted by Sergi Vladykin <se...@gmail.com>.
Yes, this is not supported, use separate caches for separate types.

Sergi

2016-08-15 1:29 GMT+03:00 zshamrock <al...@gmail.com>:

> I have a simple hierarchy: Location abstract class, and PlayerLocation and
> BallLocation extensions of the parent abstract class Location.
>
> If I do SQL query for the `cache<String, Location>`, nothing is returned
> back (even though the cache.size() eq to 5). Same true in H2 console -
> trying to query for * entries returns empty resultset (even doing new
> `SqlQuery<>(Location.class, "1 == 1");` returns empty list back.
>
> Although if I change everything to use the concrete class PlayerLocation,
> everything then works like expected, I can query entries from H2, get the
> expected resultset from Java code, etc.
>
> So, is it possible still to declare cache storing the parent abstract
> class,
> and story any of its children, and do query on later on it? Is there the
> way
> to enable it, or it is just simply not supported, and I have to use 2
> caches
> instead - one for player, and one for ball locations, which is not perfect.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/SqlQuery-on-hierarchy-of-classes-doesn-
> t-work-tp7049.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>