Posted By

corporem on 09/24/11


Tagged

Hibernate criteria


Versions (?)

Hibernate Criteria Left Join


 / Published in: ActionScript 3
 

  1. public List<Item> findBySectionId(Integer sectionId) {
  2. return getCurrentSession().createCriteria(Item.class, "i")
  3. .createAlias("i.sections", "s", Criteria.LEFT_JOIN)
  4. .add(Restrictions.eq("s.id", sectionId))
  5. .list();
  6. //
  7. // return getCurrentSession().createQuery("select distinct i from Item i left join i.sections s where s.id=:id")
  8. // .setParameter("id",sectionId).list();
  9. }

Report this snippet  

You need to login to post a comment.