此行的多个标记
- 无法将存储库解析为类型
- 注释类型
尝试将@Repository("loginDAO")
添加到loginDAOImpl.java
时出错。我不使用maven。
@Repository( “loginDAO”) 公共类LoginDAOImpl实现了LoginDAO {
@Resource(name="sessionFactory")
protected SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
protected Session getSession(){
return sessionFactory.openSession();
}
public boolean checkLogin(String userName, String userPassword) {
System.out.println("In Check login");
Session session = sessionFactory.openSession();
boolean userFound = false;
//Query using Hibernate Query Language
String SQL_QUERY =" from Users as o where o.userName=? and o.userPassword=?";
Query query = session.createQuery(SQL_QUERY);
query.setParameter(0,userName);
query.setParameter(1,userPassword);
List list = query.list();
if ((list != null) && (list.size() > 0)) {
userFound= true;
}
session.close();
return userFound;
}