You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Booking ID is null when creating bookings in MovieTicketBookingSystem #227
When creating a booking in the MovieBookingService, the booking ID is never set, resulting in a null ID value. This is visible when trying to print the booking ID in the demo.
Root Cause
In BookingManager.createBooking(), the BookingBuilder is instantiated without calling .setId():
Bookingbooking = newBooking.BookingBuilder()
.setUser(user)
.setShow(show)
.setSeats(seats)
.setTotalAmount(totalAmount)
.setPayment(payment)
.build(); // ID is never set!
Since setId() is never called, the id field in the builder remains null, and the Booking object is created with a null ID.
Impact
booking.getId() returns null
Demo output shows: Booking ID: null
This makes it impossible to track or retrieve bookings by ID
Expected Behavior
Each booking should have a unique ID automatically generated upon creation.
Solution
Generate a unique booking ID using UUID.randomUUID().toString() before building the Booking object.
Activity