-->
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: Caching using ehcache.xml
PostPosted: Thu Jun 30, 2005 9:23 am 
Regular
Regular

Joined: Fri Feb 25, 2005 3:02 am
Posts: 71
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:3.0[/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():[/b]

[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]

Hi, am actually developing an application 'A' where am using hibernate and ehcache for caching of objects. I also develop a simple interface where I could see the statistics of the cache. Am using tomcat 5.0 and my project is in a specific context. Up to now everything is ok.

My problem arises when I develop another simple aplication 'B' which is in another context. This simple application consist of only 1 jsp page in which there is an input of type file i.e

<input type="file" name="txt_file" id="txt_file">

When I click on the browse button and select the 'ehcache.xml' file to obtain the cache statistic for my application 'A' I got 0 for every method called except for the method cache.getName() and cache.getMaxElementsInMemory(). When I call cache.getSize() it returns 0. But if I use the interface found in application A to view the cache statistics I got the required values.

The only difference when am using application B which is in another context to view cache statistics of application A is that I create a CacheManager from a configuration in an InputStream, whereas in the first case I create a CacheManager from a configuration resource in the classpath.

thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2005 12:52 am 
Newbie

Joined: Fri Apr 01, 2005 2:15 am
Posts: 14
make sure that you are using same jvm instance for putting and getting
values from cache.
Thanx


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2005 1:19 am 
Regular
Regular

Joined: Fri Feb 25, 2005 3:02 am
Posts: 71
Since both of my applications run in a single instance of tomcat container, I think it should be in one JVM instance for both. Could you please tell me how I could verify this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2005 3:44 am 
Regular
Regular

Joined: Fri Feb 25, 2005 3:02 am
Posts: 71
Hi, I've checked and noted that both of my applications is running in a single JVM. Can anyone please help me solve my problem if possible


Top
 Profile  
 
 Post subject: Cache is local to SessionFactory
PostPosted: Fri Jul 01, 2005 12:07 pm 
Newbie

Joined: Fri Jan 14, 2005 2:53 pm
Posts: 7
The cache is local to your SessionFactory.

Does application B use the same SessionFactory as application A, or does it create a new one?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 04, 2005 12:51 am 
Regular
Regular

Joined: Fri Feb 25, 2005 3:02 am
Posts: 71
Application B creates a new Session Factory


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.