package org.richfaces.realworld.dao;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;
import org.richfaces.realworld.domain.User;

@Name("userHome")
public class UserHome extends EntityHome<User> {
	
	private static final long serialVersionUID = -3969822217759076582L;

	public User login(String username, String password) {
		return (User)getPersistenceContext().createQuery("select from User u where u.login = :username and u.password = :password")
					.setParameter("username", username)
					.setParameter("password", password)
					.getSingleResult();
	}
}