I have the following requirement:
Modify the Spring boot application MovieMax of Exercise 1 to use Spring Data JPA so that the data is persisted in the MySQL DB.
Fetch the theater details from theater table and movie details from movie table.
Booking a movie should update corresponding details in theatermovieshow table and booking table
The following script can be used for creation of the tables:
create table user(userid varchar(8) primary key, username varchar(25), password varchar(10), emailid varchar(30), phone int);
create table theater(theaterid varchar(8) primary key, theatername varchar(30), seatsavailable int(3), city varchar(25));
create table movie(movieid varchar(8) primary key, moviename varchar(40), language varchar(15), category varchar(20), islive boolean);
create table theatermovieshow( showid varchar(8) primary key,
theaterid varchar(8) references theater(theaterid),
movieid varchar(8) references movie(movieid),
showtime varchar(8),
startdate date,
enddate date,
ticketrate double(6,2));
create table booking(bookingid int(5), userid varchar(8) references user(userid),
showid varchar(8) references theatermovieshow(showid),
noofseats int,
amountpaid double(8,2),
showdate date,
bookingdate date);
Verification:
On execution, the required details should be fetched from database.
Verify that booking details are getting persisted in corresponding tables.
Do I need to write entity classes for each and every table? I am using spring Boot