Grokking Spring Boot
Vote

0% completed

​

Plain SQL with JdbcClient

This method builds the seat map for one event, the data behind GET /events/{id}/seats.

public List<SeatView> seatMap(long eventId) { return jdbc.sql(""" select s.label, exists (select 1 from booking b where b.seat_id = s.id and b.status = 'CONFIRMED') as taken from seat s where s.event_id = :eventId order by s.label""") .param("eventId", eventId) .query((rs, rowNum) -> new SeatView(rs.getString("label"), rs.getBoolean("taken"))) .list(); }

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content