Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1046359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:08:04+00:00 2026-05-16T16:08:04+00:00

Assuming that the two are compatible, how can I force Maven 2 to use

  • 0

Assuming that the two are compatible, how can I force Maven 2 to use Ehcache 2.2.0 instead of Ehcache 1.2.3 with Hibernate 3.3.2.GA?

Essentially, I wish to replace the puzzling and practically cyclic dependency chain

  • Hibernate Ehcache Integration 3.3.2.GA => Ehcache 1.2.3 => Hibernate 3.2.0.cr3 => Ehcache 1.2

with

  • Hibernate Ehcache Integration 3.3.2.GA => Ehcache 2.2.0

Update:

I learned that hibernate-commons-annotations-3.3.0.ga also depends on artifact ehcache-1.2.3:

[INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.3.0.ga:compile
[INFO] |  +- org.hibernate:hibernate:jar:3.2.1.ga:compile
[INFO] |  |  +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] |  |  +- asm:asm-attrs:jar:1.5.3:compile
[INFO] |  |  +- cglib:cglib:jar:2.1_3:compile
[INFO] |  |  \- asm:asm:jar:1.5.3:compile
[INFO] |  \- javax.persistence:persistence-api:jar:1.0:compile

What is the purpose of hibernate-commons-annotations-3.3.0.ga? Does Hibernate need this artifact if it uses hibernate-annotations-3.2.1-ga? Is there a replacement for this artifact that doesn’t include Ehcache? Should I simply try to exclude it from the build?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:08:05+00:00Added an answer on May 16, 2026 at 4:08 pm

    Assuming that the two are compatible, how can I force Maven 2 to use Hibernate 3.3.2.GA with Ehcache 2.2.0? According to their respective Maven POM files:

    I’ve investigated this question for my personal needs and I have now concrete answers. All the required informations are available online and I’m just posting a very short version of howto use Ehcache 2.x with Hibernate 3.3+.

    First, you need to declare the dependency on the ehcache artifact.

    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache</artifactId>
      <version>2.2.0</version>
      <type>pom</type>
    </dependency>
    

    Then, configure Hibernate for second level caching and specify the second level cache provider:

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

    Important things to note:

    • we are using the property for the new Hibernate 3.3/3.5 SPI (that Ehcache 2.0+ supports)
      • hibernate.cache.region.factory_class
    • we are using the cache provider provided by Echache
      • net.sf.ehcache.hibernate.EhCacheRegionFactory (and not o.h.c.EhCacheProvider)

    So you actually just don’t need the hibernate-ehcache artifact – and this solves the entire question 🙂 Here are the exact (relevant) dependencies I use:

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>3.4.0.GA</version>
    </dependency>
    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache</artifactId>
      <version>2.2.0</version>
      <type>pom</type>
    </dependency>
    

    And the tree:

    [INFO] +- org.hibernate:hibernate-entitymanager:jar:3.4.0.GA:compile
    [INFO] |  +- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
    [INFO] |  +- org.hibernate:hibernate-commons-annotations:jar:3.1.0.GA:compile
    [INFO] |  +- org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
    [INFO] |  +- org.hibernate:hibernate-core:jar:3.3.0.SP1:compile
    [INFO] |  |  +- antlr:antlr:jar:2.7.6:compile
    [INFO] |  |  \- commons-collections:commons-collections:jar:3.1:compile
    [INFO] |  +- org.slf4j:slf4j-api:jar:1.5.10:compile
    [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
    [INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
    [INFO] |  +- javax.transaction:jta:jar:1.1:compile
    [INFO] |  \- javassist:javassist:jar:3.4.GA:compile
    [INFO] +- ch.qos.logback:logback-classic:jar:0.9.18:compile
    [INFO] |  \- ch.qos.logback:logback-core:jar:0.9.18:compile
    [INFO] \- net.sf.ehcache:ehcache:pom:2.2.0:compile
    [INFO]    +- net.sf.ehcache:ehcache-core:jar:2.2.0:compile
    [INFO]    +- net.sf.ehcache:ehcache-terracotta:jar:2.2.0:compile
    [INFO]    \- org.terracotta:terracotta-toolkit-1.0-runtime:jar:1.0.0:compile
    

    For more details, ehcache configuration samples, official documentation, refer to the links below.

    Resources

    • Ehcache 2.0 supports new Hibernate 3.3 caching provider
    • Configure Ehcache as a Second Level Cache
    • Hibernate Second Level Cache
    • Upgrading From Ehcache versions prior to 2.0
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming that I want to use a hash as an ID instead of a
Assuming that writing nhibernate mapping files is not a big issue....or polluting your domain
Am I correct in assuming that the only difference between "windows files" and "unix
Am I correct in assuming that I always need to explicitly deploy referenced assemblies
How do you go about building a complete keyboard-accessible web application? Assuming that this
Assuming the you are implementing a user story that requires changes in all layers
Assuming a series of points in 2d space that do not self-intersect, what is
Assuming a fluid layout is not an option (since that is a different discussion
Assuming the file exists (using os.path.exists(filename) to first make sure that it does), how
Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.