bonjour j'ai une methode addUtilisateur qui fiat l'ajout et verifie si le login n'existe pas :
public void addUtilisateur(ActionEvent event) {
UtilisateurDAO utilisateurDAO = new UtilisateurDAO();
if (utilisateurDAO.findByLogin(this.getCurrentUtilisateur().getLogin()).equals(null)) {
utilisateurDAO
.addUtilisateur(this.getCurrentUtilisateur().getNom(), this
.getCurrentUtilisateur().getPrenom(), this
.getCurrentUtilisateur().getLogin(), this
.getCurrentUtilisateur().getMotDePasse(), this
.getCurrentUtilisateur().getPrivilegeConcatenated());
this.initUtilisateur(event);
this.currentUtilisateur.setErreurLogin(null);
} else {
this.currentUtilisateur.setErreurLogin("Login ("+this.getCurrentUtilisateur().getLogin()+")Existe Deja!!!veuiller Saisie un Autre");
this.currentUtilisateur.setLogin(null);
}
}
la methode findByLogin generer par hibernat:
public List findByLogin(Object login) {
return findByProperty(LOGIN, login);
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Utilisateur instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Utilisateur as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
mais le probleme est lorsque j'appelle la methode "addUtilisateur"
quelque soit le login saisie il execute toujour "else"
qulqun vois ou il est le probleme?
merci d'avance.







Répondre avec citation




Partager