Calling a Custom Query

Query the database for employees with spaces in their last name.

Let's say we want to query the database for all employees that have a space in their last name.

Exercise: Take a few minutes to write the code to find and print all employees with space in their last name.

Done? Here is what that would look like:

public CommandLineRunner run(EmployeeRepository repository) {
return (args) -> {
System.out.println(repository.findEmployeesByLastNameContaining(" "));

End Result

If you inserted the same data mentioned in the tutorial, you should the Dalia employee in the console output: Application Run Successfully