-->
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.  [ 1 post ] 
Author Message
 Post subject: load instances from query result not using secondLevelCache?
PostPosted: Fri Sep 30, 2011 9:38 am 
Newbie

Joined: Fri Sep 30, 2011 8:02 am
Posts: 1
Hi,

when loading entities from query results the following method is called in hibernate source (org.hibernate.loader.Loader:1341)
Code:
//If the object is already loaded, return the loaded one
object = session.getEntityUsingInterceptor( key );


This call attempts to find the entity in current session. If the session does not contain the entity the loader will continue loading results from database.
I wonder where second level cache is used?
Why is it not possible to get entities from second level cache?
Perhaps I'missing an important step?


Assuming that the second level cache is not called I succeeded in lookup the entity from second level cache manually using a SessionInterceptor
Code:
public Object getEntity(String entityName, Serializable id) {
    ...
    return loadFromSecondLevelCache(event, persister, loadType);
}

Are there any disadvantages from this approach?

Hibernate version 3.6.7

Thanks,

Alex


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

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.