Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate query multiple times or fetch relevant rows by one query and process them in java
    primarykey
    data
    text
    <p>I am having a problem ; which approach is better.</p> <p>I have to query a database 10000 times(or more) to fetch exactly 10000 rows &amp; then display them.</p> <p>I can do the same in one query to the database by writing a long query carefully &amp; arrange them locally &amp; then display them.</p> <p>For eg. I have name of people like this</p> <pre><code>Id Name 1 Amit 2 Mohan 3 Rohan 4 John 5 Kuneel 6 Monu 7 Savita 8 Hari 9 Raju 10 Sita List one="Amit","Mohan","Rohan","John" List two="Kuneel","Monu","Savita" List three="Hari","Raju" List n="Sita",... </code></pre> <p>for first list I will query using or operator &amp; a List of integers will be returned. Can I query for getting Ids of all Lists as a List of Integers &amp; then count on them &amp; arrange them to show Ids? My question is should I go for querying all List separately or do this in one query &amp; then arrange the result. Please help. Any Link,clue or reference is appreciable. Thank you. </p> <p>Mysql queries : For getting list one's IDs</p> <pre><code>Select Id from User where(name) IN("Amit","Mohan","Rohan",John"); </code></pre> <p>Now in HQl the equivalent query will return a list of integers. Also the names will be stored in an array of String &amp; will be used to make query string.</p> <p>But I want to do it like:</p> <pre><code> Select Id from User where(name) IN("Amit","Mohan","Rohan","John","Kuneel", "Monu","Savita","Hari","Raju","Sita","&amp; other names"); </code></pre> <p>and the list of string returned by running this query can be seen as first four ids correspond to first list(List one), next three to second &amp; so on.Also the first id of the list corresponds to the first name of the first list i.e. <code>list one</code>.</p> <p>Plz tell if you need more explaination.</p> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload