Skip to content

Commit

Permalink
Update example projects to set hibernate-ehcache dependency
Browse files Browse the repository at this point in the history
While excluding hibernate-core (javax) and including jboss-transaction-api
  • Loading branch information
jamesfredley committed Feb 20, 2025
1 parent ab9ebd8 commit 54db32a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion examples/grails3-hibernate5-mongodb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ dependencies {
runtimeOnly 'org.grails.plugins:scaffolding'
runtimeOnly 'org.grails:grails-plugin-i18n'
runtimeOnly 'org.grails:grails-plugin-url-mappings'
runtimeOnly 'org.hibernate:hibernate-ehcache'
runtimeOnly "org.hibernate:hibernate-ehcache:$hibernateVersion", {
// exclude javax variant of hibernate-core
exclude group: "org.hibernate", module: "hibernate-core"
}
runtimeOnly "org.jboss.spec.javax.transaction:jboss-transaction-api_1.3_spec:$jbossTransactionApiVersion", {
// required for hibernate-ehcache to work with javax variant of hibernate-core excluded
}
runtimeOnly 'org.springframework.boot:spring-boot-autoconfigure'
runtimeOnly 'org.springframework.boot:spring-boot-starter-logging'
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
Expand Down
8 changes: 8 additions & 0 deletions examples/gson-templates/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ dependencies {
runtimeOnly project(':views-json-templates')
runtimeOnly 'com.bertramlabs.plugins:asset-pipeline-grails'

runtimeOnly "org.hibernate:hibernate-ehcache:$hibernateVersion", {
// exclude javax variant of hibernate-core
exclude group: "org.hibernate", module: "hibernate-core"
}
runtimeOnly "org.jboss.spec.javax.transaction:jboss-transaction-api_1.3_spec:$jbossTransactionApiVersion", {
// required for hibernate-ehcache to work with javax variant of hibernate-core excluded
}

integrationTestImplementation 'org.grails:grails-testing-support'
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gson-templates/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ hibernate:
queries: false
use_second_level_cache: false
use_query_cache: false
#region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'

endpoints:
jmx:
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ testcontainersMongodbVersion=1.20.1
# for example apps only
grailsSpringSecurityCoreVersion=7.0.0-SNAPSHOT
grailsSpringSecurityRestVersion=6.0.0-SNAPSHOT
hibernateVersion=5.6.15.Final
jbossTransactionApiVersion=2.0.0.Final

# This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs
# https://github.com/grails/grails-gradle-plugin/issues/222
Expand Down

0 comments on commit 54db32a

Please sign in to comment.