I am dividing my data into shards based on which user it belongs to.
My initial plan was take the user ID modulo the number of shards to determine which shard a user belongs to. The problem is my ShardSelectionStrategy gets called before an ID is assigned to the user via a ShardedTableHiLoGenerator. I can, however, get around this by generating the IDs outside of hibernate and assigning them directly to the User at object creation time.
My questions are a) Overall is this sharding strategy sound? b) Is there a way to have hibernate assign the IDs
Thanks,
Eric
|