ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Magda <dma...@gridgain.com>
Subject Re: The result of cross-cache SQL joins is incomplete.
Date Fri, 30 Oct 2015 13:45:45 GMT
To properly build affinity keys you need to follow parent-child relationship
between A, B and C.

Let's consider that 
A - is a Department
B - is an Employee
C - is Salary

And we want to store all employees data that belong to a particular
department on the same node (collocate departments with their employees).
Also we need to collocate employees with their salary information.

To fulfill this task we just need to put employees and their salaries on the
same node where an employee's department is located.

Example,

Department dep = new Department();
dep.setId(10);

departmentsCache.put(dep.getId(), dep);

Employee emp = new Employee();
emp.setId(200334);
emp.setDepId(dep.getId());

// Employee will be stored on the same node where a department with
emp.getDepId() is located
employeesCache.put(new AffinityKey(emp.getDepId(), emp.getId());
  

Salary sal = new Salary();
sal.setId(47382947);
sal.setEmpId(emp.getId());

// Salary will be stored on the same node where a department with
emp.getDepId() is located
salaryCache.put(new AffinityKey(emp.getDepId(), sal.getId());


Hope this example helps you to understand how to properly build AffinityKeys
and you'll be able to do the same for your A, B and C object.

Don't hesitate to ask additional questions if any.

Regards,
Denis



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/The-result-of-cross-cache-SQL-joins-is-incomplete-tp1723p1782.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message