Sample Spring Boot applications demonstrating the dinuk
JDBC driver, which rewrites SQL issued against jdbc:dinuk:<real-url> to route
each statement to the correct physical partition table.
This is a thin Maven reactor (packaging=pom) that aggregates the two sample
apps below; each keeps its own Spring Boot parent and is independently
runnable. mvn clean compile (or install) from this directory builds both
in one pass; see each app's own README for how to run it and its endpoints.
| Module | Domain | Partition types demonstrated | CRUD idiom |
|---|---|---|---|
ecommerce |
An online shop: customers, orders, order items, products | key (customers), range (orders/order_items, co-partitioned master-detail with a real FK) |
Bulk @Modifying @Query for updates/deletes — the partition key isn't part of any entity's id |
helpdesk |
A multi-region support desk: customers, agents, tickets, ticket comments, knowledge articles | key (customers), hash (agents, on their own id), range (tickets/ticket_comments, co-partitioned), list (articles) |
Plain save()/delete()/deleteById() for routine CRUD — the partition key is folded into each entity's @EmbeddedId (or, for Agent, is the id itself) |
ecommerce shows dinuk's core partition rewriting across key, range,
and list strategies, with updates and deletes done as explicit bulk JPQL
@Modifying queries carrying the partition key in the WHERE clause — the
idiom required when the partition key isn't part of the entity's identity.
helpdesk answers a follow-up question: can routine writes go through
plain Spring Data save()/delete()/deleteById() instead? It does, by
folding the partition key into a composite @EmbeddedId (or, for hash-sharded
Agent, by partitioning on the id itself) — Hibernate then includes the
partition key in every generated UPDATE/DELETE/SELECT ... WHERE id=?
automatically. It also adds a fourth partition type, hash, and demonstrates
the one recurring exception: changing a row's partition key still needs an
explicit native @Modifying query (CustomerRepository.relocate,
KnowledgeArticleRepository.recategorize), since JPA treats a composite @Id
as immutable.
Both apps use an in-memory H2 database seeded fresh on every run, so neither
needs any external setup beyond mvn spring-boot:run.
Note on schema design: the table schemas in both apps are shaped around showcasing dinuk's partition types and rewriting rules, not around modeling a real e-commerce or helpdesk system well. Denormalization, composite keys, and other choices that would be questionable in a production schema are made here specifically to exercise the library's features.