Bonjour,
j'ai effectué des modifications au niveau de ma base de donnée, j'ai supprimé des tables et je les recharger aprés j'ai executé mon hibernate reverse enginnering et jai remarqué qu'au niveau UserDAO les methodes findbyLogin findByPassword qui sont d'habitudes généré automatiquement ne se trouve pas, bref je les ajouter manuelemnt mais quand j'excute mon code qui est le même du premiere et qui marchais trés bien m'affiche un mesage d'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
javax.servlet.ServletException: org.hibernate.QueryException: could not resolve property: login of: com.load.hibernate.User [from com.load.hibernate.User as model where model.login= ?]
	org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
	org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
voici les methode ajouté au niveau userDAO
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public class UserDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory.getLog(UserDAO.class);
 
	// property constants
	public static final String LOGIN = "login";
	public static final String PASSWORD = "password";
public List findByProperty(String propertyName, Object value) {
		log.debug("finding User instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from User 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;
		}
	}
	public List findByLogin(Object login) {
		return findByProperty(LOGIN, login);
	}public List findByPassword(Object password) {
		return findByProperty(PASSWORD, password);
	}
mon authentifAction
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
AuthentifForm authentifForm = (AuthentifForm) form;// TODO Auto-generated method stub
		String map="ko";
		String login = authentifForm.getLogin();
		System.out.println("login  = "+login);
		String password = authentifForm.getPassword();
		System.out.println("password  = "+password);
		UserDAO dao = new UserDAO();
	    List<?> log= dao.findByLogin(login);
		System.out.println("log size  = "+log.size());
		List<?> pwd= dao.findByPassword(password);
		System.out.println("pwd size  = "+pwd.size());
 
	    if(log.size()!=0 && pwd.size()!=0)
 
		{System.out.println("utilisateur authentifié");
			map="ok";}
		return mapping.findForward(map);
help me pleae