From d1e2fde833679feee86f9ac88b19cf0ec9be285a Mon Sep 17 00:00:00 2001 From: Sergey Iryupin Date: Sat, 15 Jun 2024 16:26:04 +0200 Subject: [PATCH] java pizza project #2 update --- .../java/pizza/repository/db/CustomerDbRepository.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BerlinAIT/Cohort42.1project/JavaPizzaMvn/src/main/java/pizza/repository/db/CustomerDbRepository.java b/BerlinAIT/Cohort42.1project/JavaPizzaMvn/src/main/java/pizza/repository/db/CustomerDbRepository.java index 2ed735d1..1da418b5 100644 --- a/BerlinAIT/Cohort42.1project/JavaPizzaMvn/src/main/java/pizza/repository/db/CustomerDbRepository.java +++ b/BerlinAIT/Cohort42.1project/JavaPizzaMvn/src/main/java/pizza/repository/db/CustomerDbRepository.java @@ -16,7 +16,7 @@ * Implementation of access methods to the Customer data source * * @author Sergey Iryupin - * @version 12-Jun-24 + * @version 15-Jun-24 */ public class CustomerDbRepository implements CrudRepository { @@ -97,7 +97,13 @@ public Collection findAll() { @Override public void deleteById(Integer id) { - + try (Connection connection = DriverManager.getConnection(dbName); + PreparedStatement ps = connection.prepareStatement(SQL_DELETE_BY_ID)) { + ps.setInt(1, id); + ps.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException(e); + } } @Override