i has 2 table in my database : EMPLOYEE and DEPARTMENT like this picture --> Image
In table EMPLOYEE has column LOCATION and i want to shard this table by LOCATION :
Example : if employee has LOCATION " France " --> shard0 , "USA" --> shard1, "singapore" --> shard2 ....
Here is my code :
public ShardId getShardId(String _location)
int shardId = 0;
shardId = 0;
shardId = 1;
shardId = 2;
shardId = 3;
return new ShardId(shardId);
if i shard with 1 table EMPLOYEE , it run successfully, BUT, when i shard it with table DEPARTMENT , it is wrong . It doesn't shard by LOCATION.
It return a shard with DEPARTMENT. it mean : if I has 2 employee with different LOCATION and the same ID_DEP (same DEPARTMENT) , if i shard only 1 Table EMPLOYEE by LOCATION, 2 employee will insert into different shard, BUT if i shard with 2 table EMPLOYEE and DEPARTMENT by LOCATION, 2 employee will insert into same shard (.
Please help me. sr i has bad english (.
Hibernate3 , hibernate-shards-3.0.0.Beta2, mysql-5.5.14-win32