c.createCriteria("defaultPixels",LEFT_JOIN);
Criteria pix = c.createCriteria("defaultPixels",LEFT_JOIN); pix.createCriteria("pixelsType",LEFT_JOIN); pix.createCriteria("pixelsDimensions",LEFT_JOIN);
    protected void buildQuery(Session session)     throws HibernateException, SQLException    {        Criteria c = session.createCriteria(Image.class);        c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);        c.createCriteria("defaultPixels",LEFT_JOIN);                // Add restrictions to the most distant criteria        Criteria[] hy =             Hierarchy.fetchParents(c,(Class) value(CLASS),Integer.MAX_VALUE);        hy[hy.length-1].add(Restrictions.in("id",(Collection) value(IDS)));        setCriteria( c );    }