Grokking Spring Boot
0% completed
Lazy and Eager Loading
The same line of code, em.find(Seat.class, seatId) for seat A12, ran two different SQL statements in two runs of the booking service.
Run 1: select s1_0.id,e1_0.id,e1_0.starts_at,e1_0.title,v1_0.id,v1_0.name,v1_0.rows,v1_0.seats_per_row,s1_0.label,s1_0.version from seat s1_0 left join event e1_0 on e1_0.id=s1_0.event_id left join venue v1_0 on v1_0.id=e1_0.venue_id where s1_0.id=? Run 2: select s1_0.id,s1_0.event_id,s1_0.label,s1_0.version from seat s1_0 where s1_0.id=?
The first statement read the seat, its event, and the event's venue, three tables for one seat
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%