Jeanne Boyarsky wrote:It sounds like you are asking whether you should cache the tables in Java. Like many good computer questions, "it depends." Some critieria:
- how big is the table?
- what percentage of the table do you typically read?
- how often do you read the same records from the table?
Thanks you for reply, below is my answer
- The table some time have 1000 records.
- I dont need read this table too many times
- when client sent to server request with some conditions, server need to query from Databse and get String value or Integer value to reply to client. I think if i use solution 1, i query only one time and when i need get value, i will get it from HashMap but if i use solution 2 so when i need to get value (Integer or String) i have to query every times.
But i dont like to use the solution one because it's use singleton pattern.
thanks you