GridGain:SQL 查询中的继承
GridGain: inheritance in the SQL query
是否可以在 GridGain 中使用父 class 执行查询?
假设我有 Person class 并且它是后代 CustomPerson。如果我将两种类型的对象放在同一个缓存中,我将能够 运行 像
这样的查询
GridCacheQuery<Map.Entry<Long, Party>> qry = queries.createSqlQuery(Person.class, "from Person");
需要结果集中的所有对象吗?
不,对于 GridGain 来说,它们只是两个不同的 类,因此被放入两个不同的 SQL 表中。
我建议使用像
这样的 UNION ALL 查询
select _val from Person where age = ?
union all
select _val from CustomPerson where age = ?
是否可以在 GridGain 中使用父 class 执行查询? 假设我有 Person class 并且它是后代 CustomPerson。如果我将两种类型的对象放在同一个缓存中,我将能够 运行 像
这样的查询GridCacheQuery<Map.Entry<Long, Party>> qry = queries.createSqlQuery(Person.class, "from Person");
需要结果集中的所有对象吗?
不,对于 GridGain 来说,它们只是两个不同的 类,因此被放入两个不同的 SQL 表中。
我建议使用像
这样的 UNION ALL 查询select _val from Person where age = ?
union all
select _val from CustomPerson where age = ?