Files
sdjpa4-demo/jdbc-vs-jpa/docs/output/03-entity-graph-fixed-cost.txt
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

11 lines
507 B
Plaintext

Scenario: the same lookup, but through findWithItemsAndCustomerById (an
@EntityGraph fetch), for an order with 1 item and an order with 5 items.
statements for 1-item order: 1
statements for 5-item order: 1
Both are the same number — an entity graph turns the collection fetch into a
single outer-join SELECT, so the statement count stops depending on item count.
This is the fix for scenario 02, and it is also the shape Spring Data JDBC gives
you by default with no annotation at all (see docs/05).