noone wrote:
Depends if the Entity's associations contain alot of data. If you do not need the data then why load it? You can always "join" on the property you need within the HQL statement. Sometimes you feel like a nut sometimes you don't! Sometimes it is worth marking an association lazy=false because it does not incurr a performance hit and is used most of the time the parent is retrieved. Do your uses cases justify marking the association lazy=false?
The response time must be fast so it should be retrieved from a cached source. The data doesn't change much and is read more often so every hour or so, the cache is updated from the database, otherwise the cache is read most of the time.
In hibernate 2, when it was operating from the cache, I noticed some oddities like high CPU just reading the cache, not sure if this happens in v3.
Which begs another question, if I do an HQL query, can I make it use the cache to retrieve the item? And what is the lookup like, is there an in-memory hash of the objects where it maps from ID to the object instance, making lookups by ID fast? Is there a way to "add an index" to the cache so you can look up objects quickly by any property?