Skip to content

Commit

Permalink
Caching - Ensure we set second-level cache to OFF by default, and inc…
Browse files Browse the repository at this point in the history
…lude the ehcache provider in the build.

Hoping this resolves a sticky 'No CachingProviders have been configured' error in testing an ORM app.
  • Loading branch information
michaelborn committed Jan 22, 2025
1 parent ec4e25d commit 8203557
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ dependencies {
implementation 'org.hibernate:hibernate-jcache:5.6.15.Final'
// https://mvnrepository.com/artifact/javax.cache/cache-api
implementation 'javax.cache:cache-api:1.1.1'
// https://mvnrepository.com/artifact/org.ehcache/ehcache
implementation 'org.ehcache:ehcache:3.10.8'

// Testing Dependencies
testImplementation files( '../../boxlang/build/distributions/boxlang-' + boxlangVersion + '-all.jar' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,9 @@ public Configuration toHibernateConfig() {
configuration.setPhysicalNamingStrategy( loadedNamingStrategy );
}
}

configuration.setProperty( AvailableSettings.USE_SECOND_LEVEL_CACHE, Boolean.toString( this.secondaryCacheEnabled ) );
if ( this.secondaryCacheEnabled ) {
configuration.setProperty( AvailableSettings.USE_SECOND_LEVEL_CACHE, "true" );
configuration.setProperty( AvailableSettings.USE_QUERY_CACHE, "true" );
configuration.setProperty( AvailableSettings.CACHE_REGION_FACTORY, "jcache" );
configuration.setProperty( "hibernate.javax.cache.provider", this.getJCacheProviderClassPath() );
Expand Down

0 comments on commit 8203557

Please sign in to comment.