1

We are selecting 300 000 records from database(BeanClass). After that we need to convert that List into Map<OneColumnValue(String),BeanClass>. We got it working using for loop but it's too slow (for Loading Data from DB and Looping Map).

Any better way to do this? We not to loop that again for Map creation .But we need Map<OneColumnValue(String),BeanClass>

We referred this (Hibernate Reference paragraph 14.6) but this won't help us.This return List>. In our requirement this hsql want's return Map , here K --> Primary Column values and V--->bean class object (in feature by help of key we get remaining values for our operation).for example consider Employee bean class , here id,name, dept,salary are the variables.Now we select all values from table , here we need our hql to return as Map. After that we use this map as (Employee emp=map.get("z0123")).

fredt
  • 24,044
  • 3
  • 40
  • 61
Ahaahaa
  • 31
  • 3
  • Have you measured the tipe it takes to execute the query and return the list and compared it with the time it takes to transform the list into a Map? My guess is that the latter is negligible compared to the former. – JB Nizet May 27 '15 at 17:16
  • ya it getting time to form map. – Ahaahaa May 27 '15 at 17:39
  • We refered this (Hibernate Reference paragraph 14.6) but this won't help us.This return List>.In our requirement this hsql want's return Map , here K --> Primary Column values and V--->bean class object (in feature by help of key we get remaining values for our operation).for example consider Employee bean class , here id,name,dept,salary are the variables.Now we select all values from table , here we need our hql to return as Map.Aftere that we use this map as (Employee emp=map.get("z0123")). – Ahaahaa May 28 '15 at 05:10

0 Answers0