Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ORDER BY RANDOM() in JPA?

No,  only those functions defined in the specification are guaranteed to be supported by all providers.  RAND() is not yet supported by our JPQL parser but please file an enhancement request.  Alternatively you could use native EclipseLink expressions which support custom functions or Native SQL.
--Gordon

cowwoc wrote:
http://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql
suggests a more efficient implementation but depends upon the existence of
RAND(). Does JPQL guarantee the existence of all SQL-92 or SQL-99 functions?
Can I assume that RAND() is defined?

Gili


cowwoc wrote:
  
Hi,

Is there a portable way to select N random rows using JPA?
http://www.petefreitag.com/item/466.cfm lists different vendor-specific
ways to do this but obviously I would prefer using a portable JPA query
instead.

Thank you,
Gili

    
  

Back to the top