-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Overhead of hibernate POJO files?
PostPosted: Thu Jan 05, 2006 4:19 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
What if I wanted to just read everything from the cache at once, with lazy instantiation set to false for all associations, then close the hibernate session. Would there be significant overhead in accessing the POJO classes and methods compared to just filling out POJO objects myself?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 7:07 pm 
Regular
Regular

Joined: Thu Sep 23, 2004 11:53 am
Posts: 83
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?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 8:27 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
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?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 10:31 am 
Regular
Regular

Joined: Thu Sep 23, 2004 11:53 am
Posts: 83
High CPU usage: Are you caching a lot of data? Meanning do you have enough memory to hold all the data you are caching? Sounds like a paging issue.


can I make it use the cache to retrieve the item:

Good question read 19.3. Managing the caches

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?

Calling load or get is faster then executing an HQL statement. The difference between load and get is that load will throw an exception if the id is not found.

Is there a way to "add an index" to the cache so you can look up objects quickly by any property?

No, it only works of the id field.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 2:06 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
thanks. I think I'll just make the database use a ramdrive for storage to allow me to do arbitrary queries in memory, using hibernate for POJO access.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 06, 2006 11:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Please read the cache chapter of the manual. You can cache pretty much anything, including query results.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.