-->
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.  [ 4 posts ] 
Author Message
 Post subject: Migrating Hibernate 3 to 5,org.hibernate.cache.Cache missing
PostPosted: Mon May 16, 2016 8:52 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
Hi I am trying to migrate Hibernate 3.6.1 to 5 and I can't find any guide where org.hibernate.cache.Cache were moved to.. ? In 3.6.1 it was in hibernate-core jar and in 5 it is not found in this package..

Code:
error: cannot find symbol
[ERROR] symbol:   class Cache
[ERROR] location: package org.hibernate.cache


Below is how I use org.hibernate.cache.Cache (just a snippet to show what I must rewrite or remove from project):

Code:
protected Cache getCache(final String name) {
        if (!TransactionSynchronizationManager.isSynchronizationActive())
            return null;

        final String cacheKey = getCacheKey(name);
        Cache cache = (Cache) TransactionSynchronizationManager.getResource(cacheKey);

        if (cache == null) {
            cache =  new HashtableCache(cacheKey);

            TransactionSynchronizationManager.bindResource(cacheKey, cache);
            TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {

                private Object suspended = null;
                private boolean beforeCompletionInvoked = false;


Top
 Profile  
 
 Post subject: Re: error: cannot find symbol Migrating Hibernate 3 to 4 or 5
PostPosted: Mon May 16, 2016 9:15 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
The Cache API went through some refactoring in the Hibernate 4 version. For instance, instead of CacheProvider, you now have a RegionFactory.

You can still find the Cache class in the org.hibernate package.


Top
 Profile  
 
 Post subject: Re: Migrating Hibernate 3 to 5,org.hibernate.cache.Cache missing
PostPosted: Mon May 16, 2016 10:33 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 6:55 am
Posts: 41
Thanks for answer,
It seems it would be the best to move to Hibernate 5 since there must have been another big recatoring comparing to Hibernate 4.

@mihalcea_vlad I am moving to Hibernate 5, maybe Cache is in Hibernate 4 but in 5 it is removed. I also can't see HashtableCache class. What about them?

Also RegionFactory is marked deprecated in Hibernate 5.

Since there are so many changes in cache only, I am wondering if new Spring 4.2.6 is ready for integration with Hibernate 5.


Top
 Profile  
 
 Post subject: Re: Migrating Hibernate 3 to 5,org.hibernate.cache.Cache missing
PostPosted: Mon May 16, 2016 12:12 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
org.hibernate.cache.RegionFactory is deprecated in favor for org.hibernate.cache.spi.RegionFactory, so no worries there.

HashtableCache was probably removed because Hibernate does not offer any default 2nd level cache provider mechanism. You must use Infinispan, Ehcache, or Hazelcast.

As for Spring, you need to check on their forum or user group if the Hibernate 5 integration is ready.


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