Labs
-
Create a class in the
com.example.jpavideostore.clientpackage namedJPQLLab(this is where you will complete the following steps). -
Create a method that uses JPQL to retrieve all Customers in the database whose id is between 100 and 110. Output their first name, last name, and email. (Hint: You can use the
BETWEENreserved word in JPQL just like SQL.) -
Modify your previous solution, using parameters to set the minimum and maximum ids instead of hard-coding them into the query String.
-
Refactor your program into a method in the JPQLLab class named
getRangeOfCustomers. -
the method should take two arguments (minId, maxId), both ints
-
return the correct list of Customers given these inputs
-
Create a new class in the test src folder named JPQLTest
- Write a test to ensure that
getRangeOfCustomersretrieves Customer objects within the correct range
- Write a test to ensure that
-
Write a method in the JPQLLab class named
getCustomerEmailByName. -
the method takes two Strings as an argument (fname, lname)
-
return either a single String, or
null -
write a test to ensure that a Customer can be retrieved (choose a customer that exists to test)
-
Write a method in the JPQLLab class named
getFilmByTitle. -
the method takes one String as an argument (filmTitle)
-
return either a single Film object, or
null -
write a test to ensure that a Film can be retrieved.
-
Write a method in the JPQLLab class named
getFilmsTitlesByReleaseYear. -
the method takes one int as an argument (year)
-
return the correct list of film titles (
List<String>). -
write a test to ensure that the correct Film objects were retrieved.