Composite key as Ignite key and its should be queryable

classic Classic list List threaded Threaded
3 messages Options
siva siva
Reply | Threaded
Open this post in threaded view
|

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/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]>:
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/
himanshu himanshu
Reply | Threaded
Open this post in threaded view
|

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

In reply to this post by siva
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/