select c from Class c,Student s where c.id = s.id and s..........

解决方案 »

  1.   

    select c from Class c,Student s where c.id = s.cid and s..........
      

  2.   

    from Class c order by c.students.id这样子你每次取class里的集合的前五条记录就行了.
      

  3.   

    illegal attempt to dereference collection
    告诉我间接引用不合法我想应该是这样的吧?
    select c from Class c join c.students s order by s.id desc
    可是看生成的SQL语句这个order by子句放在了获取Class语句上了。想通过增加过滤器来解决,结果又碰上另一问题。我怎么定义1个以上的过滤器呢?
      

  4.   

    看似解决了,我改成"select c from Class c join fetch c.students s order by s.id desc"