Package org.hibernate.ejb

Examples of org.hibernate.ejb.HibernateEntityManager


    protected EntityManager em;

    @Override
    public List<YFRestaurant> getTopRestaurantOfWeek() {

        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFBill.class, "bill");
        criteria.createAlias("restaurant", "r");


        criteria.setProjection(Projections.projectionList().add(Projections.alias(Projections.sum("price"), "bill.total")).add(Projections.groupProperty("r.id"))).addOrder(Order.desc("bill.total"));
View Full Code Here


    @PersistenceContext
    protected EntityManager em;

    @Override
    public List<YFEvent> getAreaEvents(YFArea area) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEvent.class);

       
        criteria.createAlias("table", "t");
        criteria.createAlias("order", "o", Criteria.LEFT_JOIN);
        // Récupération des events non traités dans le secteur qui possèdent une table OU qui possède un order
View Full Code Here

    @PersistenceContext
    protected EntityManager em;

    @Override
    public YFEmployee getEmployee(String username, String hashedPassword) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);

        criteria.add(Restrictions.eq("username", username)).add(Restrictions.eq("password", hashedPassword));

        try {
            return (YFEmployee) criteria.uniqueResult();
View Full Code Here

        return em.find(YFEmployee.class, id);
    }

    @Override
    public YFEmployee getEmployee(String username) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);

        criteria.add(Restrictions.eq("username", username));

        try {
            return (YFEmployee) criteria.uniqueResult();
View Full Code Here

        em.merge(employee);
    }

    @Override
    public List<YFEmployee> getEmployees(YFJob job) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);
        System.out.println(job);
        criteria.add(Restrictions.like("job", job));

        return criteria.list();
    }
View Full Code Here

        return criteria.list();
    }

    @Override
    public List<YFEmployee> getEmployeesFromRestaurant(long restaurantId) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);
       
        criteria.add(Restrictions.eq("restaurant.id", restaurantId));       
        return criteria.list();
    }
View Full Code Here

        return criteria.list();
    }

    @Override
    public YFEmployee getEmployeeFromRestaurant(long employeeId, long restaurantId) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);
       
        criteria.add(Restrictions.eq("restaurant.id", restaurantId));
        criteria.add(Restrictions.eq("id", employeeId));
        return (YFEmployee) criteria.uniqueResult();
    }
View Full Code Here

        return (YFEmployee) criteria.uniqueResult();
    }

    @Override
    public List<YFEmployee> getRestaurantWaiters(YFRestaurant restaurant) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);
       
        criteria.add(Restrictions.eq("job", YFJob.WAITER));
        criteria.add(Restrictions.eq("restaurant.id", restaurant.getId()));
       
        return criteria.list();
View Full Code Here

        return criteria.list();
    }

    @Override
    public List<YFEmployee> getEmployeesFromRestaurant(YFJob job, long id) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFEmployee.class);
       
        criteria.add(Restrictions.eq("job", job));
        criteria.add(Restrictions.eq("restaurant.id", id));       
        return criteria.list();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.ejb.HibernateEntityManager

Copyright © 2018 www.massapicom. 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.