Package org.hibernate.ejb

Examples of org.hibernate.ejb.HibernateEntityManager


    assertTrue(emfi.getNativeEntityManagerFactory() instanceof HibernateEntityManagerFactory);
  }

  public void testCanCastSharedEntityManagerProxyToHibernateEntityManager() {
    assertTrue(sharedEntityManager instanceof HibernateEntityManager);
    HibernateEntityManager hibernateEntityManager = (HibernateEntityManager) sharedEntityManager;
    assertNotNull(hibernateEntityManager.getSession());
  }
View Full Code Here


           
            eventType.setId(0);
        }
       
        //No id, do a lookup based on the event type
        final HibernateEntityManager hibernateEntityManager = ((HibernateEntityManager)this.entityManager);
        final Session session = hibernateEntityManager.getSession();
       
        //Setup the Criteria query
        final Criteria eventTypeCriteria = session.createCriteria(EventType.class);
        eventTypeCriteria.add(Restrictions.naturalId().set("type", eventType.getType()));
        eventTypeCriteria.setCacheable(true);
View Full Code Here

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

    @Override
    public List<YFDish> getDishByDishCategory(Long dishCategoryId) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFDish.class);
       
        criteria.createAlias("themes", "t")
                .add(Restrictions.eq("dishCategory.id", dishCategoryId))
                .add(Restrictions.eq("t.active", true));
       
View Full Code Here

    }

    @Override
    public List<YFDish> getDishBeginingBy(String begin) {
//        System.out.println("-----------------------" + begin);
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFDish.class);
       
        criteria.add(Restrictions.ilike("name", begin + "%"))
                .addOrder(Order.asc("name"));
       
        return criteria.list();
View Full Code Here

        return this.em.find(YFMenuMenuCategory.class, mmcId);
    }

    @Override
    public List<YFMenuMenuCategory> getFromMenu(Long menuId) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFMenuMenuCategory.class);

        criteria.createAlias("menu", "m").add(Restrictions.eq("m.id", menuId)).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

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

        return criteria.list();
    }

    @Override
    public List<YFMenuMenuCategory> getFromDish(Long dishId) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFMenuMenuCategory.class);

        criteria.createAlias("dishes", "d").add(Restrictions.eq("d.id", dishId));

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

        return criteria.list();
    }

    @Override
    public List<YFMenuMenuCategory> getFromMenuCategory(Long mcId) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFMenuMenuCategory.class);

        criteria.createAlias("menuCategorie", "mc").add(Restrictions.eq("mc", mcId));

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

        return criteria.list();
    }

    @Override
    public YFMenuMenuCategory getMenuMenuCategory(YFMenu menu, YFMenuCategory menuCategory) {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFMenuMenuCategory.class);

        criteria.add(Restrictions.eq("menu.id", menu.getId()));
        criteria.add(Restrictions.eq("menuCategory.id", menuCategory.getId()));
        try {
            return (YFMenuMenuCategory) criteria.uniqueResult();
View Full Code Here

        }
    }

    @Override
    public List<YFMenu> getCurrentMenus() {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFMenu.class);
       
        criteria.createAlias("themes", "t")
                .add(Restrictions.eq("t.active", true))
                .addOrder(Order.asc("name"));
       
View Full Code Here

    @PersistenceContext
    protected EntityManager em;

    @Override
    public List<YFTheme> getAllThemes() {
        HibernateEntityManager hem = (HibernateEntityManager) em.getDelegate();
        Criteria criteria = hem.getSession().createCriteria(YFTheme.class);
        criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
        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.