You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.login login0_ where login0_.name='admin' and login0_.password='123456' limit 1' at line 1代码
public class LoginDaoImpl implements LoginDao{

public Login checkLogin(String name,String password) {
Session session=null;
Transaction tx=null;
Login login=null;
try{
session=HibernateSessionFactory.getSession();
tx=session.beginTransaction();
Query query=session.createQuery("from Login where name=?and password=?");
query.setParameter(0, name);
query.setParameter(1, password);
query.setMaxResults(1);
login=(Login) query.uniqueResult();
tx.commit();
}catch(Exception e){
if(tx!=null)tx.rollback();
e.printStackTrace();
}
return login;
}
}
用的mysql数据库