ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From relax ken <relax....@gmail.com>
Subject Re: can't get or query but scan works
Date Thu, 08 Aug 2019 15:19:29 GMT
sorry, nvm, it was a wrong setup. both work now. sorry for the spawn

On Thu, Aug 8, 2019 at 4:12 PM relax ken <relax.ken@gmail.com> wrote:

> to correct the query, I did set args
>
> `userDBRecordCache.query(new SqlFieldsQuery("select userId from " +
> UserIgniteRecord.class.getSimpleName() + " where username =
> ?").setArgs(userName));`
>
> copied a wrong one in my last email
>
> On Thu, Aug 8, 2019 at 4:09 PM relax ken <relax.ken@gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to use ignite query and indexing by following ignite example
>> but can't get it work.
>>
>> Here is my entity class:
>>
>> public class UserIgniteRecord {
>>     @QuerySqlField(index = true)
>>     public final String userId;
>>
>>     @QuerySqlField(index = true)
>>     public final String username;
>>
>>     @QuerySqlField(index = true)
>>     public final String email;
>>
>>     public String getUserId() {
>>         return userId;
>>     }
>>
>>     public String getUsername() {
>>         return username;
>>     }
>>
>>     public String getEmail() {
>>         return email;
>>     }
>>
>>     public String getDeviceUniqueIdentifier() {
>>         return deviceUniqueIdentifier;
>>     }
>>
>>     public UserIgniteRecord(String userId, String username, String email) {
>>         this.userId = userId;
>>         this.username = username;
>>         this.email = email;
>>     }
>>
>>     @Override
>>     public String toString(){
>>         return userId +", "+ username + ", " + email;
>>     }
>> }
>>
>> I tried both `cconfig.setIndexedTypes(String.class, UserIgniteRecord.class);` and
queryEntity
>>
>> When I scan, I get all records `[IgniteBiTuple [val1=250c187c-550a-44b3-bb33-79f1caa0f318,
val2=250c187c-550a-44b3-bb33-79f1caa0f318, meme2, ], IgniteBiTuple [val1=1fdec81a-7b5a-444c-b184-675effee4177,
val2=1fdec81a-7b5a-444c-b184-675effee4177, meme3, ], IgniteBiTuple [val1=1883e05c-64a4-499a-96fa-ea91b807a301,
val2=1883e05c-64a4-499a-96fa-ea91b807a301, meme, ], IgniteBiTuple [val1=87b407ee-77c0-4d59-b53e-5c83af22cb7f,
val2=87b407ee-77c0-4d59-b53e-5c83af22cb7f, meme2, ]]`
>>
>> But when I use `userDBRecordCache.get(userId)`, cache returned nothing and also tried
to load from persistence.
>>
>> The same empty result for query `userDBRecordCache.query(new SqlFieldsQuery("select
userId from " + UserIgniteRecord.class.getSimpleName() + " where username = ?"));`
>>
>> Any ideas?
>>
>>
>> Thanks
>>
>>
>>
>>

Mime
View raw message