From 8eba4fe1695c541ca82315b8fd7e9665ef4e9a68 Mon Sep 17 00:00:00 2001 From: Sewaaa Date: Wed, 27 Dec 2023 16:16:11 +0100 Subject: [PATCH] DAOCondition v.2 --- .../model/DAO/{DAODisease.java => DAOCondition.java} | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) rename src/main/java/model/DAO/{DAODisease.java => DAOCondition.java} (81%) diff --git a/src/main/java/model/DAO/DAODisease.java b/src/main/java/model/DAO/DAOCondition.java similarity index 81% rename from src/main/java/model/DAO/DAODisease.java rename to src/main/java/model/DAO/DAOCondition.java index c128ed7..851535d 100644 --- a/src/main/java/model/DAO/DAODisease.java +++ b/src/main/java/model/DAO/DAOCondition.java @@ -1,21 +1,20 @@ package model.DAO; import model.entity.Condition; -import model.entity.User; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -public class DAODisease { +public class DAOCondition { private Condition getConditionFromResultSet(ResultSet resultSet) throws SQLException { Condition condition = new Condition(); - condition.setIdCondition(resultSet.getInt("ID")); - condition.setDisorderName(resultSet.getString("Name_Disorder")); //probabilmente nomi attrivuti sbagliati - condition.setDisorderDescription(resultSet.getString("Disorder_Description")); //probabilmente nomi attrivuti sbagliati + condition.setIdCondition(resultSet.getInt("ID_condition")); + condition.setDisorderName(resultSet.getString("DisorderName ")); + condition.setDisorderDescription(resultSet.getString("DisorderDescription ")); return condition; } @@ -29,7 +28,7 @@ public Condition getConditionByID(int id) { connection = DAOConnection.getConnection(); String query = null; - query = "SELECT * FROM condition WHERE ID = ?"; + query = "SELECT * FROM condition WHERE ID_condition = ?"; preparedStatement = connection.prepareStatement(query); @@ -56,5 +55,4 @@ public Condition getConditionByID(int id) { } return null; // or you may throw an exception here } - }