package locadora.persistencia.dao;

import java.util.List;

import locadora.hibernate.Dao;
import locadora.modelo.user.User;

import org.hibernate.Session;


public class UserDAO extends Dao<User> {

	public UserDAO(Class<User> type, Session session) {
		super(type, session);
	}
	
	public User verificaLogin(String email,String senha) {
		List<User> lista = session.createQuery("from User where senha = :senha and email = :email")
							.setParameter("senha",	senha)
							.setParameter("email", email).list();
		if (lista.size() == 1)
			return lista.get(0);
		return null;
	}
	
}
