Hi guys,
I am using Hibernate JCS in my project, I've tried "session.iterate(..)", and "session.load(...)" these two methods to access data. And also in order to see if data from cache or database, I turned on "log4j.logger.net.sf.hibernate.cache=debug", as you know I excepted to see "Caching hit" message when I use the data after the first time. "session.load(...)" works fine for me, the first time I saw "Caching new..." and after that showed me "Caching hit...", but for "session.iterate(...)" it showed me "Caching new..." always, I thought I may did something wrong, anyone knows how should it work? Thanks a lot for help!
my code for iterate:
-------------------------------------------
Session session = sessionFactory.openSession();
Iterator iter = session.iterate("from com.hibernate.Alias as alias");
while (iter.hasNext())
{
Alias myAlias = (Alias) iter.next();
System.out.println("-------client is----" + myAlias.getClient());
System.out.println("-------subclient is----" + myAlias.getSub_client());
}
--------------------------------------------
my code for load:
--------------------------------------------
Session session = sessionFactory.openSession();
Alias alias = (Alias) session.load(Alias.class, primarKey);
System.out.println("-------client is----" + alias.getClient());
System.out.println("-------subclient is----" + alias.getSub_client());
--------------------------------------------
|