Package ru.portnyagin.helpdeskru.service

Source Code of ru.portnyagin.helpdeskru.service.StateRequestService

/**
*
* @author ilya portnyagin iportnyagin@gmail.com
*/

package ru.portnyagin.helpdeskru.service;

import java.util.List;
import java.util.Map;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import ru.portnyagin.helpdeskru.model.StateRequest;

@Stateless
public class StateRequestService extends AbstractService<StateRequest> {
    @PersistenceContext(unitName = "HelpDeskRuPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public StateRequestService() {
        super(StateRequest.class);
    }
   
    public void findMapStateRequest(Map<String, StateRequest> map) {
        CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
        CriteriaQuery cq = cb.createQuery();
        Root<StateRequest> z = cq.from(StateRequest.class);
        cq.select(z);
       
        List<StateRequest>x = em.createQuery(cq).getResultList();
       
        for(StateRequest xx: x) {
            map.put(xx.getId(), xx);
        }
       
    }
 
   

  
}
TOP

Related Classes of ru.portnyagin.helpdeskru.service.StateRequestService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.