package hlx.DaoImpl;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import po.HibernateSessionFactory;
import hlx.Dao.UsersDao;
import hlx.bean.Userinfo;
public class UsersDaoImpl implements UsersDao{
public boolean userLogin(Userinfo u) {
// TODO Auto-generated method stub
Transaction tr = null;
String hql ="";
try {
Session session = HibernateSessionFactory.getSession();
hql="from Userinfo where userName=? and userPassword =?";
tr = session.beginTransaction();
Query query = session.createQuery(hql);
query.setParameter(0, u.getUserName());
query.setParameter(1, u.getUserPassword());
List list = query.list();
tr.commit();
session.close();
if(list.size()>0){
return true;
}else{
return false;
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return false;
}finally{
if(tr!=null){
tr=null; //释放资源
}
}
}
}
找出问题所在了。java.lang.nosuchmethoderror;antlr.collections.AST.getLinew()I,解决办法,在myeclipse下,windows-》preference——》project capabilities-》remove掉struts2的 antlr2.7.2 。jar包就好了