Files
sdjpa4-demo/jdbc-vs-jpa/docs/output/10-list-order-key-column.txt
T
asmhatre 448c383879 Add jdbc-vs-jpa module: Spring Data JDBC vs JPA on a shared Order aggregate
Same Customer/Order/OrderItem domain modelled with Hibernate/Spring Data JPA and
Spring Data JDBC side by side, both running through a shared StatementLoggingDataSource
so SQL-statement counts are directly comparable. 11 tests, 11 captured transcripts,
6 doc chapters. Companion repo for the ankurm.com article on when to drop the ORM.
2026-09-17 19:09:35 +00:00

12 lines
591 B
Plaintext

Scenario: save items in the order [SKU-Z, SKU-A, SKU-M] (deliberately not
alphabetical), reload, and read the list back.
reloaded order: [SKU-Z, SKU-A, SKU-M]
@MappedCollection(idColumn = "order_id", keyColumn = "order_key") is what makes
this deterministic. Without keyColumn, Spring Data JDBC still stores a List
correctly, but the reload order is whatever the database happens to return —
usually insertion order on a fresh H2 table, but that is an implementation
detail, not a guarantee, and it is the kind of thing that breaks quietly on a
different database or after a compaction.