You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by siva <si...@bizruntime.com> on 2018/09/24 13:40:55 UTC

Composite key as Ignite key and its should be queryable

Hi,

How to set and query a composite key?

i have two model classes
class Transaction{
    
   private string personId;
   private Date transactionDay;
     
}
class Person{
   @QuerySqlField
   private Transaction transaction;
   @QuerySqlField
   private string Name;
   @QuerySqlField
   private string City;   
}

while storing into ignite using like
cache.put(transaction,person)

Query:
======
1.How can we appaly sql query based on personId and transactionDay?
select * from Person where transactionDay = '2018-9-12'










--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Composite key as Ignite key and its should be queryable

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

You should annotate those fields with @QuerySqlField in key class like you
did in Value class.

Note that you may need SQL indexes for optimal performance.

Regards,
-- 
Ilya Kasnacheev


пн, 24 сент. 2018 г. в 16:41, siva <si...@bizruntime.com>:

> Hi,
>
> How to set and query a composite key?
>
> i have two model classes
> class Transaction{
>
>    private string personId;
>    private Date transactionDay;
>
> }
> class Person{
>    @QuerySqlField
>    private Transaction transaction;
>    @QuerySqlField
>    private string Name;
>    @QuerySqlField
>    private string City;
> }
>
> while storing into ignite using like
> cache.put(transaction,person)
>
> Query:
> ======
> 1.How can we appaly sql query based on personId and transactionDay?
> select * from Person where transactionDay = '2018-9-12'
>
>
>
>
>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Composite key as Ignite key and its should be queryable

Posted by himanshu <hi...@gmail.com>.
Siva, did it work for you? I am also trying similar use case and running into
issues



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/