You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Gaurav Bajaj <ga...@gmail.com> on 2016/12/07 08:04:36 UTC

Querying over fields in the object inside Cache value

Hi,

Is is possible to query (Scan, Sql etc) cache on the fields inside object
in the Cache value?

For example :
Employee has a Address
Address has fields like Street, Zip code, City

Cache Key : Emp Id
Cache Value : Employee

Is it possible to Index or Query on field "City" in the above scenario?
I tried to look through documentation and examples but didn't find any such
scenario or may be I overlooked.

Thanks for your answers/suggestions.

Best Regards,
Gaurav

Re: Querying over fields in the object inside Cache value

Posted by Gaurav Bajaj <ga...@gmail.com>.
Perfect Thanks for prompt reply.

On Wed, Dec 7, 2016 at 10:32 AM, Sergi Vladykin <se...@gmail.com>
wrote:

> Yes, in QueryEntity you have to define it using a dot notation.
>
> Sergi
>
> 2016-12-07 12:22 GMT+03:00 Gaurav Bajaj <ga...@gmail.com>:
>
>> Great. Thanks for prompt reply. What is the way to indicate same via
>> configuration?
>>
>> For example, for Address it will be as per below, but not sure how to do
>> it for City.
>>
>> <bean class="org.apache.ignite.cache.QueryEntity">
>>                                 <property name="keyType"
>> value="java.lang.String"/>
>>                                 <property name="valueType"
>> value="Employee"/>
>>                                 <property name="fields">
>>                                     <map>
>>                                         <entry key="address"
>> value="Address"/>
>>                                         <entry key="address.city"
>> value="java.lang.String"/>     //Is this the way?
>>                                     </map>
>>                                 </property>
>> </bean>
>>
>> On Wed, Dec 7, 2016 at 10:12 AM, Sergi Vladykin <sergi.vladykin@gmail.com
>> > wrote:
>>
>>> Yes, this is possible.
>>>
>>> If you have QuerySqlField annotation on Employee.address and the same
>>> annotation on Address.city, then the field CITY must be available for
>>> SQL queries.
>>>
>>> Sergi
>>>
>>> 2016-12-07 11:04 GMT+03:00 Gaurav Bajaj <ga...@gmail.com>:
>>>
>>>> Hi,
>>>>
>>>> Is is possible to query (Scan, Sql etc) cache on the fields inside
>>>> object in the Cache value?
>>>>
>>>> For example :
>>>> Employee has a Address
>>>> Address has fields like Street, Zip code, City
>>>>
>>>> Cache Key : Emp Id
>>>> Cache Value : Employee
>>>>
>>>> Is it possible to Index or Query on field "City" in the above scenario?
>>>> I tried to look through documentation and examples but didn't find any
>>>> such scenario or may be I overlooked.
>>>>
>>>> Thanks for your answers/suggestions.
>>>>
>>>> Best Regards,
>>>> Gaurav
>>>>
>>>
>>>
>>
>

Re: Querying over fields in the object inside Cache value

Posted by Sergi Vladykin <se...@gmail.com>.
Yes, in QueryEntity you have to define it using a dot notation.

Sergi

2016-12-07 12:22 GMT+03:00 Gaurav Bajaj <ga...@gmail.com>:

> Great. Thanks for prompt reply. What is the way to indicate same via
> configuration?
>
> For example, for Address it will be as per below, but not sure how to do
> it for City.
>
> <bean class="org.apache.ignite.cache.QueryEntity">
>                                 <property name="keyType"
> value="java.lang.String"/>
>                                 <property name="valueType"
> value="Employee"/>
>                                 <property name="fields">
>                                     <map>
>                                         <entry key="address"
> value="Address"/>
>                                         <entry key="address.city"
> value="java.lang.String"/>     //Is this the way?
>                                     </map>
>                                 </property>
> </bean>
>
> On Wed, Dec 7, 2016 at 10:12 AM, Sergi Vladykin <se...@gmail.com>
> wrote:
>
>> Yes, this is possible.
>>
>> If you have QuerySqlField annotation on Employee.address and the same
>> annotation on Address.city, then the field CITY must be available for
>> SQL queries.
>>
>> Sergi
>>
>> 2016-12-07 11:04 GMT+03:00 Gaurav Bajaj <ga...@gmail.com>:
>>
>>> Hi,
>>>
>>> Is is possible to query (Scan, Sql etc) cache on the fields inside
>>> object in the Cache value?
>>>
>>> For example :
>>> Employee has a Address
>>> Address has fields like Street, Zip code, City
>>>
>>> Cache Key : Emp Id
>>> Cache Value : Employee
>>>
>>> Is it possible to Index or Query on field "City" in the above scenario?
>>> I tried to look through documentation and examples but didn't find any
>>> such scenario or may be I overlooked.
>>>
>>> Thanks for your answers/suggestions.
>>>
>>> Best Regards,
>>> Gaurav
>>>
>>
>>
>

Re: Querying over fields in the object inside Cache value

Posted by Gaurav Bajaj <ga...@gmail.com>.
Great. Thanks for prompt reply. What is the way to indicate same via
configuration?

For example, for Address it will be as per below, but not sure how to do it
for City.

<bean class="org.apache.ignite.cache.QueryEntity">
                                <property name="keyType"
value="java.lang.String"/>
                                <property name="valueType"
value="Employee"/>
                                <property name="fields">
                                    <map>
                                        <entry key="address"
value="Address"/>
                                        <entry key="address.city"
value="java.lang.String"/>     //Is this the way?
                                    </map>
                                </property>
</bean>

On Wed, Dec 7, 2016 at 10:12 AM, Sergi Vladykin <se...@gmail.com>
wrote:

> Yes, this is possible.
>
> If you have QuerySqlField annotation on Employee.address and the same
> annotation on Address.city, then the field CITY must be available for SQL
> queries.
>
> Sergi
>
> 2016-12-07 11:04 GMT+03:00 Gaurav Bajaj <ga...@gmail.com>:
>
>> Hi,
>>
>> Is is possible to query (Scan, Sql etc) cache on the fields inside object
>> in the Cache value?
>>
>> For example :
>> Employee has a Address
>> Address has fields like Street, Zip code, City
>>
>> Cache Key : Emp Id
>> Cache Value : Employee
>>
>> Is it possible to Index or Query on field "City" in the above scenario?
>> I tried to look through documentation and examples but didn't find any
>> such scenario or may be I overlooked.
>>
>> Thanks for your answers/suggestions.
>>
>> Best Regards,
>> Gaurav
>>
>
>

Re: Querying over fields in the object inside Cache value

Posted by Sergi Vladykin <se...@gmail.com>.
Yes, this is possible.

If you have QuerySqlField annotation on Employee.address and the same
annotation on Address.city, then the field CITY must be available for SQL
queries.

Sergi

2016-12-07 11:04 GMT+03:00 Gaurav Bajaj <ga...@gmail.com>:

> Hi,
>
> Is is possible to query (Scan, Sql etc) cache on the fields inside object
> in the Cache value?
>
> For example :
> Employee has a Address
> Address has fields like Street, Zip code, City
>
> Cache Key : Emp Id
> Cache Value : Employee
>
> Is it possible to Index or Query on field "City" in the above scenario?
> I tried to look through documentation and examples but didn't find any
> such scenario or may be I overlooked.
>
> Thanks for your answers/suggestions.
>
> Best Regards,
> Gaurav
>