-->
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.  [ 12 posts ] 
Author Message
 Post subject: how to solve net/sf/ehcache/CacheException exception??
PostPosted: Tue Feb 28, 2006 5:44 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
Hi All,

I am using hibernate3.

To handle cache i specified
Code:
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

In my hibernate.cfg.xml file. it was working fine.

now i changed it to
Code:
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>


when i run this i am getting exception.
Code:
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException


can anybody tell me what is the problem and how to solve it.


thanks in advance
balag


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 28, 2006 8:11 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
Hi All,

i am using hibernate3 , but the error shows net/sf/ehcache/CacheException

i know that net.sf.chcache. this package is old version of hibernate.

since i am using 3.0 how to solve this issue???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 28, 2006 9:12 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
did you try:

hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
in your hibernate.properties file?

See my other post for when .properties vs. cfg.xml files are read.

http://forum.hibernate.org/viewtopic.php?t=956099&highlight=hibernate+properties

Let me know if that helps...

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 3:33 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
hi

i am using xml file. and in my lib folder hibernate3.jar is present.

i dont know why i am getting ClassDefNotFoundException.


do i need to get any other jar file or what??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 3:44 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
ehcache-1.1.jar is in the <hibernate>/lib dir - put that in your classpath.

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 6:19 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
Hi,

Thanks i got it . now it is not showing that exception.

Actually i want to use cache to improve the performance of hibernate.

Since i am using JSF , when the user hit the submit button it takes 8 to 12 seconds to display the result.

so i want to use EhCacheProvider to improve the performance. But now also the performance is same. i am not doing any write . Its only read from the database.

so let me know what should i do to improve the speed.


and your replies are really useful.

thanks
balag


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 6:32 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
A strategy for read-only data is to make sure cache is setup as read-only ... and then instead of doing database "join" on your data, use "select" ... this way the base entity is selected (without db join) and pulls all read-only data from the jvm-hibernate env.

See my other post:
http://forum.hibernate.org/viewtopic.php?t=956099&highlight=

to setup read-only caching.

fetch="join|select" (join is database join, and select is fetching cached objects from jvm).

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 7:02 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
HI All,

Thanks for your effort to clarify my doubts.

but now also the performance is same. no improvement.

First of all it takes time for one page, where there is no relationship between two tables.

so i am calling two dao's. getting the id and then pass it to another dao method to get that object.

i am not sure the performance is because of hibernate or the tomcat server which i am using???


anyway thanks you so much.

meantime i have one more doubt.i posted in forum but no response.

My doubt is there are 2 tables. One parent and one child table. child table does not have the primary field . It has only foreign field since it is a child table.

so how will you map the <id> attribute in child.xml file.

what i did was i simply mapped another column in <id> attribute of child.xml. That is no where related.

eg:

Code:
<class name="Child" table="child" discriminator-value="Child">
   <id name="status" column="STATUS" type="string">
   </id>

   <many-to-one name="parent" column="ID" insert="false"   update="false"  class="Parent"/>   
   
<!--property name="status" column="STATUS" not-null="false" type="string"/-->
<property name="message" column="MESSAGE" not-null="false" type="string"/>
      
</class>

here status is one column in chid table . it is not a primary column or foreign column or unique column.

Anyway i got the desired output. But i am not sure this is right or wrong??


please let me know.......


i really appreciate you. thanks for your effort.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 7:14 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
the book recommends to map all the cols as primary key, if no pk.

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 7:17 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
Thanks a lot JT.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 7:43 pm 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
HI

I want to query the data based on date using between function
eg:

Select * FROM PROFILE_EVENT
WHERE TRUNC(EVENT_DATE_TIME) BETWEEN TO_DATE('02/21/2006','MM/dd/yyyy') AND TO_DATE('02/21/2006','MM/dd/yyyy')


when i execute this in oracle i am getting result.

when i execute this in hibernate i am getting no result.


hibernate generated query does not have trunc, to_date function.

Select * FROM PROFILE_EVENT
WHERE EVENT_DATE_TIME BETWEEN ? AND ?


how to query in hibernate??

thanks in advance
balag


Top
 Profile  
 
 Post subject: Re: how to solve net/sf/ehcache/CacheException exception??
PostPosted: Tue Jun 09, 2009 7:08 am 
Newbie

Joined: Tue Jun 09, 2009 6:47 am
Posts: 1
This problem is realated to Classloading problems - May be you have the two jars inside different classloaders . Make sure that Hibernate and ehcache jar are in the same dir (thus the same classpath and classloader) and make sure there are no duplicates or older versions.

place these two jar file either in jboss/server/default/lib or in your application/WEB-INF/lib folder

Gajendra


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