Announcement Announcement Module
Collapse
No announcement yet.
limit the number of results Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • limit the number of results

    Hi,

    This may seem simple, but I haven't been able to find an answer.

    I just want to get a result list but a limited number of items.

    I tried....

    getHibernateTemplate().find("from anObject ORDER BY RAND() fetch first ? rows only", 10);

    But it doesn't want to work.

    Any help would be appreciated.

    Thanks,
    hasdy

  • #2
    try to use this:
    Code:
    ...
    //somewhere before calling 'find' method, set max rows to return
    getHibernateTemplate().setMaxResults(10);
    ...
    getHibernateTemplate().find("from anObject ORDER BY RAND() ");

    Comment

    Working...
    X