diff --git a/complete/src/main/java/com/example/accessingdatajpa/AccessingDataJpaApplication.java b/complete/src/main/java/com/example/accessingdatajpa/AccessingDataJpaApplication.java index be1a0d8..95adede 100644 --- a/complete/src/main/java/com/example/accessingdatajpa/AccessingDataJpaApplication.java +++ b/complete/src/main/java/com/example/accessingdatajpa/AccessingDataJpaApplication.java @@ -29,9 +29,9 @@ public CommandLineRunner demo(CustomerRepository repository) { // fetch all customers log.info("Customers found with findAll():"); log.info("-------------------------------"); - for (Customer customer : repository.findAll()) { + repository.findAll().forEach(customer -> { log.info(customer.toString()); - } + }); log.info(""); // fetch an individual customer by ID @@ -47,9 +47,6 @@ public CommandLineRunner demo(CustomerRepository repository) { repository.findByLastName("Bauer").forEach(bauer -> { log.info(bauer.toString()); }); - // for (Customer bauer : repository.findByLastName("Bauer")) { - // log.info(bauer.toString()); - // } log.info(""); }; }