Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3501606
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:52:49+00:00 2026-05-18T12:52:49+00:00

Does anyone have HQL query on how to get list of 10 random unique

  • 0

Does anyone have HQL query on how to get list of 10 random unique objects from the database?

It should be done in database not in application. I’d like to get something that has better performance than my current solution which pretty much makes 10 requests to get the list filed up.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:52:50+00:00Added an answer on May 18, 2026 at 12:52 pm

    I’m no HQL expert by any means, but in SQL you would do this with

    select ... order by RANDOM() limit 10
    

    So with a bit of googling, I figured out how to do the limit bit and the random bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have a query that will select n number of random rows from
does anyone have a nice solution to get de price wich is a variable
Does anyone have some code that will take a TimeZoneInfo field from .NET and
Does anyone have any idea why my server cannot read the database file? No
Does anyone have the xaml to get the look and feel of this UI?
Does anyone have an idea of how to get posts that have no comments
Does anyone have base32 implementation in Delphi? I found: http://cc.embarcadero.com/item/21566 but it is not
Does anyone have a definitive answer to whether Sql Server Management Objects is compatible
Does anyone have any idea if CloudFoundry is based on IaaS and datacenters from
does anyone have good code examples of inserting listview into sqlite database? i googled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.