Bonjour,
Je suis actuellement en train de développer une application en utilisant Hibernate. Le problème, c'est que lorsque je
veux modifier un élément, aucun changement n'est effectué en base de données et aucun message d'erreur
apparait à l'écran.
J'ai trois table : projet(qui contient un client et une liste de prestations)
client
prestation
Ce que je veux faire c'est modifier les champs d'un projet:
méthode:
public Projet modifierProjet(int idProjet, int idClient, String nom, Calendar dateCreation, Calendar tempsEstime,double prix) throws HibernateException, InexistantException, ArgumentInvalideException {
Projet p = ProjetDAO.getInstance().rechercher(idProjet);
if(p==null)
throw new InexistantException();
Client c = ClientDAO.getInstance().rechercher(idClient);
if(c==null)
throw new InexistantException();
p.setClient(p.getClient());
p.setDateCreation(p.getDateCreation());
p.setNom(p.getNom());
// p.setPrestationSet(p.getPrestationSet());
p.setPrix(p.getPrix());
p.setTempsEstime(p.getTempsEstime());
p.setClient(c);
p = ProjetDAO.getInstance().mettreAJour(p);
ClientDAO.getInstance().mettreAJour(c);
return p;
}
Methode mettreAJour dans mon DAO:
public Projet mettreAJour(Projet p) throws HibernateException {
session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
session.update(p);
tx.commit();
return p;
}
Quelqu'un peut il m'aider ?
Partager