You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by techbysample <tu...@netmille.com> on 2016/11/06 15:35:26 UTC

Question: When to use CacheConfiguration.setIndexedTypes()?

Support,

In review of Ignite Documentation (1.7.0) , I have the following questions
about the proper use of 'CacheConfiguration.setIndexedTypes'

In the 'ignite-examples' that come with distribution, the 'Person' class is
annotated
as follows:

   //Person's annotations
    /** Person ID (indexed). */
    @QuerySqlField(index = true)
    public Long id;

    /** Organization ID (indexed). */
    @QuerySqlField(index = true)
    public Long orgId;

    /** Salary (indexed). */
    @QuerySqlField(index = true)
    public double salary;

  In the 'Person' class, 3 fields are  annotated (@QuerySqlField(index =
true))
  indexed: 'id', 'orgId', and 'salary'.

 However, in the 'CacheQueryExample' class, it's main method contains:

            personCacheCfg.setIndexedTypes(AffinityKey.class, Person.class);


Question:
Will you explain when it is necessary for
CacheConfiguration.setIndexedTypes()
to be applied for  respective fields annotated with @QuerySqlField(index =
true)?

IE: Why  isn't 'salary' used in CacheConfiguration.setIndexedTypes()?


Please advise.

Regards,
techbysample








--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Question-When-to-use-CacheConfiguration-setIndexedTypes-tp8721.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Question: When to use CacheConfiguration.setIndexedTypes()?

Posted by techbysample <tu...@netmille.com>.
Forum,

Thank you!

Regards,
techbysample



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Question-When-to-use-CacheConfiguration-setIndexedTypes-tp8721p8829.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Question: When to use CacheConfiguration.setIndexedTypes()?

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi,
Please do not call the community as support.

The method (.setIndexedTypes())  was destinated for determine class of keys
and values, in order to extract annotation (@QuerySqlField) from them[1].

Another way you can use QueryEntry approach[2] and assign indexies directly
in config or code.

[1]:
http://apacheignite.gridgain.org/docs/sql-queries#configuring-sql-indexes-by-annotations
[2]:
http://apacheignite.gridgain.org/docs/sql-queries#configuring-sql-indexes-using-queryentity

On Sun, Nov 6, 2016 at 6:35 PM, techbysample <tu...@netmille.com> wrote:

> Support,
>
> In review of Ignite Documentation (1.7.0) , I have the following questions
> about the proper use of 'CacheConfiguration.setIndexedTypes'
>
> In the 'ignite-examples' that come with distribution, the 'Person' class is
> annotated
> as follows:
>
>    //Person's annotations
>     /** Person ID (indexed). */
>     @QuerySqlField(index = true)
>     public Long id;
>
>     /** Organization ID (indexed). */
>     @QuerySqlField(index = true)
>     public Long orgId;
>
>     /** Salary (indexed). */
>     @QuerySqlField(index = true)
>     public double salary;
>
>   In the 'Person' class, 3 fields are  annotated (@QuerySqlField(index =
> true))
>   indexed: 'id', 'orgId', and 'salary'.
>
>  However, in the 'CacheQueryExample' class, it's main method contains:
>
>             personCacheCfg.setIndexedTypes(AffinityKey.class,
> Person.class);
>
>
> Question:
> Will you explain when it is necessary for
> CacheConfiguration.setIndexedTypes()
> to be applied for  respective fields annotated with @QuerySqlField(index =
> true)?
>
> IE: Why  isn't 'salary' used in CacheConfiguration.setIndexedTypes()?
>
>
> Please advise.
>
> Regards,
> techbysample
>
>
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Question-When-to-use-CacheConfiguration-
> setIndexedTypes-tp8721.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov