All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.appfuse.dao.jpa.LookupDaoJpa Maven / Gradle / Ivy

package org.appfuse.dao.jpa;

import java.util.List;

import org.appfuse.dao.LookupDao;
import org.appfuse.model.Role;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;

/**
 * JPA implementation of LookupDao.
 *
 * @author Bryan Noll
 */
@Repository
public class LookupDaoJpa implements LookupDao {
    private Log log = LogFactory.getLog(LookupDaoJpa.class);
    @PersistenceContext
    EntityManager entityManager;

    /**
     * {@inheritDoc}
     */
    @SuppressWarnings("unchecked")
    public List getRoles() {
        log.debug("Retrieving all role names...");

        return entityManager.createQuery(
                "select r from Role r order by name").getResultList();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy