-->
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.  [ 4 posts ] 
Author Message
 Post subject: OSCache - how is it supposed to work - Hibernate slow now...
PostPosted: Fri Feb 06, 2004 8:02 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I have
<cache usage="read-only"/>

under a few <class>'es which represent good ol' code tables. I have a list of object of type A which refer to these "code objects" which are cached.

Yet, when I navigate from A to any of the code objects, hibernate generates SQL selects.

This makes the call horribly slow to traverse (thousands of selects just for a few hundred rows)

I use lazy="true" in the relation from class A to it's "code objects".

What's going on?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2004 8:35 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I tried going from session.find to session.iterate, but that dramatically slowed down the loop.

In my head, when I have a readonly <cache > under a <class>, Hibernate should always read from the cache, not issue selects'

Ummm. Anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2004 6:24 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Umm - I cannot belive how slow find / iterate is.

The relationships are typically many-to-one... isn't those cached?

I tried to use JDBC and Hibernate to do the same thing. I'm using lazy sets and OSCache:

Getting 150 objects having 10 associations to other objects.

JDBC: 350 ms
Hibernate: 5 seconds
Hibernate, using iterate: 11 seconds

What on earth is going on???


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2004 7:03 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
When I don't close the session - the first call is slow, but the next call is superfast - I see from the SQL output that caching is effective.

But I have a session-per-request paradigm. Can I call disconnect() in that architecture???

I am only <cache> 'ing a few small tables, so that should be ok - right?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.