2 Replies Latest reply on Dec 30, 2011 7:19 AM by eremmel

    Hibernate Tools + Ehcache

    krasig

      Hi,

      I have hibernate.cfg.xml like this:

      ...

      ....

      <property name="hibernate.cache.use_query_cache">true</property>

        <property name="hibernate.cache.use_second_level_cache">true</property>

        <property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>

        <property name="hibernate.cache.provider_configuration_file_resource_path">/ehcache2.xml</property>

      ..

      ...

       

       

       

      When i try to create connection with Hibernate Tools =>

       

      java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache.getCacheConfiguration()Lnet/sf/ehcache/config/CacheConfiguration;

       

       

      Any help is welcome.

       

      Regards.

        • 1. Re: Hibernate Tools + Ehcache
          maxandersen

          Simplest workaround: don't enable caching from the hibernate configuration you use in the tools (doesn't make much sense anyway).

           

          It's most likely caused by you using Hibernate 3.6 or newer which has API changes that can cause problems.

          • 2. Re: Hibernate Tools + Ehcache
            eremmel

            I also noticed the error: java.lang.NoSuchMethodError: net.sf.ehcache.config.CacheConfiguration.isTerracottaClustered () Z

             

            With hibernate 3.6.9, ehcache-core-2.5.0 and HT plugin for eclipse org.jboss.tools.hibernate4_0_3.4.0.v20111221-0406-H613-Beta1

             

            When using Hibernate Tools in Eclipse. I share the configuration between Hibernate Tools and my project settings.

            I found at http://javahigh1.iteye.com/blog/1205893 a solution (thanks to google translate), I like to share (In is inlike with the remark of Max).

            Do not use the new property:

            <property name="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory"/>

            but the old one:

            <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider"/>

            in your configuration.