package Tests;
import DAO.EvaluationADAO;
import DAO.EvaluationDAO;
import Entities.Agence;
import Entities.BabySitter;
import Entities.Evaluation;
import Entities.EvaluationAgence;
import Entities.Utilisateur;
import Interfaces.IEvaluationA;
import java.sql.SQLException;
public class EvaluationAgenceTest
{
public static void main(String[] args) throws SQLException
{
IEvaluationA ieva = new EvaluationADAO();
// Evaluation e = ieva.findEvaluationById(2);
Agence AA=new Agence(4);
AA.setIdUser(4);
BabySitter B=new BabySitter();
B.setIdUser(1);
EvaluationAgence ev1 = new EvaluationAgence (1,"","",AA,B,AA);
ev1.setAgence(AA);
Utilisateur u2 =new Utilisateur("uuu", "", "" , "", "","", 222, null, null, null, 15, 147, 14, 14);
IEvaluationA iev = EvaluationADAO.getInstance();
iev.insertEvaluation(ev1);
}}
please guys,help me,it's very important !
class EvaluationAgenceDAO:
..........................
public void insertEvaluation(EvaluationAgence eva)
{
String requete = "INSERT INTO evaluation (note,date,description,idUser,id_babysitter) values (?,?,?,?,?)";
try {
PreparedStatement ps = connection.prepareStatement(requete);
//Utilisateur u = new Utilisateur();
ps.setInt(2, eva.getNote());
ps.setString(3, eva.getDate());
ps.setString(4, eva.getDescription());
ps.setInt(5, eva.getUtilisateur().getIdUser());
ps.setInt(5, eva.getAgence().getIdUser());
ps.setInt(6,eva.getBabySitter().getIdUser());
//Forein Key
//ps.setInt(4, 1);
ps.executeUpdate();
System.out.println("Ajout effectuée avec succès");
}
catch (SQLException ex)
{
System.out.println(`enter code here`"Erreur lors de l'insertion " + ex.getMessage());
}}
I can't find the solution. In my code, class EvaluationAgence I want that one agence can evaluate the work of any babysitter.
Aucun commentaire:
Enregistrer un commentaire