Card 05/ 07
All 7 cards
ExampleDifficulty: Advanced1 min
A Spring Data JDBC Repository, End to End
A BookingAggregate is the aggregate root the previous card described. BookingJdbcRepository is the one repository it gets, and there's no repository written for anything inside it.
@Table("bookings")
record BookingAggregate(@Id Long id, String pickup) {}
interface BookingJdbcRepository extends CrudRepository<BookingAggregate, Long> {}Spring Data JDBC saved aggregate with generated id: 1
count: 1No @OneToMany, no lazy proxy, no persistence context to watch it — save() writes the aggregate in full, and findById would read it back the same way, in one round trip each.