Order By Rand by Time (HQL)
Posted
by Felipe
on Stack Overflow
See other posts from Stack Overflow
or by Felipe
Published on 2010-05-26T17:31:29Z
Indexed on
2010/05/26
17:41 UTC
Read the original article
Hit count: 330
Hi all, I'm developing a web application using asp.net Mvc 2 and NHibernate, and I'm paging data (products in a category) in my page, but this data are random, so, I'm using a HQL statement link this:
string hql = "from Product p where p.Category.Id=:IdCategory order by rand()";
It's working fine, but when I page, sometimes the same product appears in the first, second, etc... pages because it's order by rand().
Is there any way to make a random order by fixed by period (time internal) ? Or any solution ?
thanks
Cheers
© Stack Overflow or respective owner