File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Storing data rows in hashmap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Storing data rows in hashmap" Watch "Storing data rows in hashmap" New topic

Storing data rows in hashmap

rachana ravali
Ranch Hand

Joined: Jun 20, 2006
Posts: 32
Hi ,
i have a requirement where i have to put rows from database into hashmap as keys and values.
I have a doubt whether hashmap can support large data such as 2000 records or entries.

Can any one please clarify whether it is a good idea to have such as huge data in maps for avoiding network traffic with database.

Thanks in advance.
Manish Singh
Ranch Hand

Joined: Jan 26, 2007
Posts: 160
If it reduces the DB calls then yes. And you need to look at whats the size of the entry. I mean you should be aware of the total memory taken by the hashmap
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

2000? That isn't "huge". It isn't even "large". Consider that your memory is measured in megabytes -- that's millions of bytes.
rachana ravali
Ranch Hand

Joined: Jun 20, 2006
Posts: 32
thanks manish and paul ... thank you very much for replying..
I agree. Here's the link:
subject: Storing data rows in hashmap
Similar Threads
How to uplaod excel data into mysql data base in struts..?
How to store an XML file as a string in database and retrieve in Java code
Limiting rowsize in h:dataTable
Data Caching Best Practices ?
Performance between ..searching in . hashmap or xml document