Denis,

This is rather simple change. Hopefully we will get it done by 2.2 release.

On Fri, May 12, 2017 at 9:16 PM, Denis Magda <[email protected]> wrote:

> Here is a ticket:
> https://issues.apache.org/jira/browse/IGNITE-5211
>
> Vovan, can it be done in 2.1?
>
> —
> Denis
>
> > On May 11, 2017, at 4:14 PM, Denis Magda <[email protected]> wrote:
> >
> > Guys,
> >
> > Let’s suppose there is a cache that stores entries like that:
> >
> > * key - int
> > * value - custom object which fields are annotated by @QuerySqlField
> >
> > Before 2.0 if I wanted to refer to the key in an SQL query I had to use
> “_key” keyword. In 2.0 this is no longer the requirement. Any name can be
> used in the condition it’s set via QueryEntity.setKeyFieldName(keyName).
> >
> > This concept works perfectly fine if both key's and value's types are
> configured using QueryEntities directly. But what can I do if the value is
> annotated with @QuerySqlField as in the example above and passed to SQL
> engine via CacheConfiguration.setIndexedTypes(…) method? How can I set
> QueryEntity.setKeyFieldName()?
> >
> > Looks like the only workable way is this one:
> > - register key and value types via CacheConfiguration.setIndexedTypes(…)
> > - find the QueryEntity corresponding to the just registered types in a
> collection of CacheConfiguration.getQueryEntities()
> > - call QueryEntity.setKeyFieldName(keyName) for the entity of interest.
> >
> > Basically, this is a workaround but not a user friendly approach. Is
> there any other way to achieve this?
> >
> > In the meanwhile, what if we add QueryEntity(Class keyType, Class
> valueType) that will do totally the same things that 
> CacheConfiguration.setIndexedTypes(…)
> with the only difference that right after that the user will be able to
> call QueryEntity.setKeyFieldName(keyName)?
> >
> > —
> > Denis
> >
>
>

Reply via email to