Skip to content

Commit 31165c1

Browse files
authored
Merge pull request #16 from Rurutia1027/refine-sharding
Refine sharding persistence based entity and services
2 parents 747e23a + 7933582 commit 31165c1

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package org.tus.common.sharding.entity;
22

3-
import org.tus.common.domain.persistence.SimplePersistedObject;
3+
import org.tus.common.domain.persistence.PersistedObject;
44

55
/**
66
* Optional base class for entities that participate in sharding.
7-
* <p>
8-
* This lives in the sharding module and extends the generic SimplePersistedObject
9-
* from persistence-common, so persistence-common itself does not depend on sharding.
10-
* <p>
7+
*
8+
* Extends PersistedObject so they work with QueryService and ShardingAwareQueryService.
9+
*
1110
* Usage:
1211
* <pre>
13-
* ShardedEntity
14-
* public class User extends SharedPersistedObject {
15-
* @ShardingKey
16-
* private String userId;
12+
* &#064;ShardedEntity
13+
* &#064;AttributeOverride(name = "id", column = &#064;Column(name = "id"))
14+
* public class UserCoupon extends ShardedPersistedObject {
15+
* &#064;ShardingKey
16+
* private Long userId;
1717
* }
1818
* </pre>
1919
*/
20-
public abstract class ShardedPersistedObject extends SimplePersistedObject {
20+
public abstract class ShardedPersistedObject extends PersistedObject {
2121
}
22+

persistence-sharding/src/main/java/org/tus/common/sharding/service/ShardingAwareQueryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
/**
1313
* Sharding-aware facade on top of the core QueryService.
14-
* <p>
14+
*
1515
* This interface is intentionally small and focused on the most common access patterns:
1616
* - find by id
1717
* - list query
1818
* - paged query
19-
* <p>
19+
*
2020
* All operations take a ShardingContext so that callers are forced to think about
2121
* sharding/tenant keys when accessing sharded entities.
2222
*/

0 commit comments

Comments
 (0)