You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/09/17 18:26:54 UTC
(grails-core) 04/04: build: remove Hibernate 5 support from grails-forge
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 9.0.x-remove-h5
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit f4a8b902c852b60d31c081b8677f43414f3469ed
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Thu Sep 17 09:49:49 2026 -0500
build: remove Hibernate 5 support from grails-forge
grails-forge is the application generator's own separate build; it had a
fully parallel GormImpl.HIBERNATE5 option and GrailsDataHibernate5 feature
class alongside the Hibernate 7 one, defaulting to Hibernate 5.
Removes GrailsDataHibernate5 and the now-vacuous GrailsDataHibernateValidator
(which only existed to reject selecting both Hibernate implementations at
once - there is only one now). GormImpl.DEFAULT_OPTION becomes HIBERNATE7,
the HIBERNATE5 enum constant is removed, and the legacy "hibernate" CLI/API
alias now resolves to HIBERNATE7 instead. GrailsDataHibernate7 gets the
@Primary annotation GrailsDataHibernate5 held, since PostgreSQL/SQLServer/
MySQL/GraphqlGorm/AsyncGorm/DatabaseDriverFeature all constructor-inject the
concrete Hibernate feature class as their "default to Hibernate when no GORM
provider is chosen" fallback - all six were retyped from
GrailsDataHibernate5 to GrailsDataHibernate7. DatabaseMigrationPlugin's
artifact-selection ternary (hibernate7-dbmigration vs hibernate5-dbmigration)
collapses to the sole surviving artifact, and its stale hibernate5 doc URL
is fixed. The two Spring Security domain-class templates drop the now-moot
gorm-hibernate5 alternative from their feature check.
Explicitly requesting the removed value is rejected with a clear error
rather than silently substituted, at every layer: the "-d/--data"/"-g/--gorm"
CLI flag (GormImplConverter throws TypeConversionException; verified with a
real PicocliRunner.run() invocation, not just unit-level reasoning), and the
"--features gorm-hibernate5" feature-selection path (already throws
"The requested feature does not exist" from existing framework code, now
covered by a regression test). GormImpl.parse("hibernate5") returns null
(unresolvable) rather than matching any constant.
Fixes a pre-existing bug this surfaced in the test fixture BuildBuilder:
renderBuildSrc() built its Options with a constructor that silently dropped
whatever .gormImpl(...) the test had set, always falling back to
GormImpl.DEFAULT_OPTION. This was invisible while the default happened to
be HIBERNATE5 (the exact value every prior renderBuildSrc() test needed);
switching the default to HIBERNATE7 exposed it. render() already used the
correct constructor - renderBuildSrc() now matches it.
Verified with a full `./gradlew build` across every grails-forge module
(core, api, cli, analytics-postgres, and the netty/undertow/tomcat runners):
all tests pass, including new regression coverage proving gorm-hibernate5
and --gorm hibernate5 are now cleanly rejected rather than silently
mishandled.
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
---
.../postgres/StoreGeneratedProjectStatsSpec.groovy | 2 +-
.../grails/forge/api/FeatureControllerSpec.groovy | 2 +-
.../CodeGenConfigDevelopmentReloadingSpec.groovy | 6 +-
.../forge/cli/command/CreateAppCommandSpec.groovy | 12 +-
.../grails/forge/feature/database/AsyncGorm.java | 10 +-
.../feature/database/DatabaseDriverFeature.java | 12 +-
.../feature/database/GrailsDataHibernate5.java | 129 ---------------------
.../feature/database/GrailsDataHibernate7.java | 2 +
.../database/GrailsDataHibernateValidator.java | 49 --------
.../grails/forge/feature/database/GraphqlGorm.java | 10 +-
.../java/org/grails/forge/feature/database/H2.java | 2 +-
.../org/grails/forge/feature/database/MySQL.java | 4 +-
.../grails/forge/feature/database/PostgreSQL.java | 4 +-
.../grails/forge/feature/database/SQLServer.java | 4 +-
.../grails/forge/feature/grails/GrailsBase.java | 5 +-
.../feature/migration/DatabaseMigrationPlugin.java | 8 +-
.../feature/security/template/user.rocker.raw | 2 +-
.../security/template/userClassic.rocker.raw | 2 +-
.../java/org/grails/forge/options/GormImpl.java | 13 ++-
.../groovy/org/grails/forge/BuildBuilder.groovy | 2 +-
.../forge/feature/database/AsyncGormSpec.groovy | 6 +-
.../database/GrailsDataHibernate5Spec.groovy | 105 -----------------
.../database/GrailsDataHibernate7Spec.groovy | 14 ++-
.../feature/database/GrailsDataMongoDBSpec.groovy | 7 +-
.../forge/feature/database/GraphqlGormSpec.groovy | 6 +-
.../grails/forge/feature/database/MySQLSpec.groovy | 2 +-
.../forge/feature/database/PostgresSpec.groovy | 2 +-
.../forge/feature/database/SQLServerSpec.groovy | 2 +-
.../migration/DatabaseMigrationPluginSpec.groovy | 10 +-
.../security/GrailsSpringSecuritySpec.groovy | 1 -
.../security/SpringBootStarterSecuritySpec.groovy | 1 -
.../org/grails/forge/options/GormImplSpec.groovy | 16 ++-
32 files changed, 87 insertions(+), 365 deletions(-)
diff --git a/grails-forge/grails-forge-analytics-postgres/src/test/groovy/org/grails/forge/analytics/postgres/StoreGeneratedProjectStatsSpec.groovy b/grails-forge/grails-forge-analytics-postgres/src/test/groovy/org/grails/forge/analytics/postgres/StoreGeneratedProjectStatsSpec.groovy
index 517a6edd34..5f5666678c 100644
--- a/grails-forge/grails-forge-analytics-postgres/src/test/groovy/org/grails/forge/analytics/postgres/StoreGeneratedProjectStatsSpec.groovy
+++ b/grails-forge/grails-forge-analytics-postgres/src/test/groovy/org/grails/forge/analytics/postgres/StoreGeneratedProjectStatsSpec.groovy
@@ -73,7 +73,7 @@ class StoreGeneratedProjectStatsSpec extends Specification implements TestProper
given:
def generated = new Generated(
ApplicationType.WEB,
- GormImpl.HIBERNATE5,
+ GormImpl.HIBERNATE7,
ServletImpl.TOMCAT,
DevelopmentReloading.DEVTOOLS,
JdkVersion.DEFAULT_OPTION
diff --git a/grails-forge/grails-forge-api/src/test/groovy/org/grails/forge/api/FeatureControllerSpec.groovy b/grails-forge/grails-forge-api/src/test/groovy/org/grails/forge/api/FeatureControllerSpec.groovy
index 3967fd42aa..6ff1f480d7 100644
--- a/grails-forge/grails-forge-api/src/test/groovy/org/grails/forge/api/FeatureControllerSpec.groovy
+++ b/grails-forge/grails-forge-api/src/test/groovy/org/grails/forge/api/FeatureControllerSpec.groovy
@@ -116,7 +116,7 @@ class FeatureControllerSpec extends Specification {
then:
!features.any { it.name == 'geb-with-testcontainers' }
- features.any { it.name == 'gorm-hibernate5' }
+ features.any { it.name == 'gorm-hibernate7' }
when:
features = applicationTypeClient
diff --git a/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/CodeGenConfigDevelopmentReloadingSpec.groovy b/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/CodeGenConfigDevelopmentReloadingSpec.groovy
index bb99bb8fe7..41964ca395 100644
--- a/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/CodeGenConfigDevelopmentReloadingSpec.groovy
+++ b/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/CodeGenConfigDevelopmentReloadingSpec.groovy
@@ -50,7 +50,7 @@ applicationType: web
defaultPackage: org.example
reloading: devtools
sourceLanguage: groovy
-features: [gorm-hibernate5, asset-pipeline-grails]
+features: [gorm-hibernate7, asset-pipeline-grails]
'''
File yamlFile = new File(tempDir.toFile(), "grails-forge-cli.yml")
yamlFile.text = yamlContent
@@ -64,7 +64,7 @@ features: [gorm-hibernate5, asset-pipeline-grails]
config.reloading.name() == "DEVTOOLS"
config.applicationType.getName() == "web"
config.sourceLanguage.name() == "GROOVY"
- config.features.contains("gorm-hibernate5")
+ config.features.contains("gorm-hibernate7")
!config.legacy
}
@@ -103,7 +103,7 @@ applicationType: plugin
defaultPackage: org.example.plugin
reloading: jrebel
sourceLanguage: groovy
-features: [gorm-hibernate5]
+features: [gorm-hibernate7]
'''
File yamlFile = new File(tempDir.toFile(), "grails-cli.yml")
yamlFile.text = yamlContent
diff --git a/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy b/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy
index a842071ee6..2650320fb5 100644
--- a/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy
+++ b/grails-forge/grails-forge-cli/src/test/groovy/org/grails/forge/cli/command/CreateAppCommandSpec.groovy
@@ -112,7 +112,7 @@ class CreateAppCommandSpec extends CommandSpec implements CommandFixture {
System.setOut(new PrintStream(out))
when:
- PicocliRunner.run(CreateAppCommand, ctx, "gshort", "-g", "hibernate5")
+ PicocliRunner.run(CreateAppCommand, ctx, "gshort", "-g", "hibernate7")
then:
noExceptionThrown()
@@ -132,17 +132,19 @@ class CreateAppCommandSpec extends CommandSpec implements CommandFixture {
out.toString().contains("Application created")
}
- void "test creating a project with the hibernate5 gorm value"() {
+ void "test creating a project with the removed hibernate5 gorm value is rejected"() {
given:
ByteArrayOutputStream out = new ByteArrayOutputStream()
+ ByteArrayOutputStream err = new ByteArrayOutputStream()
System.setOut(new PrintStream(out))
+ System.setErr(new PrintStream(err))
when:
PicocliRunner.run(CreateAppCommand, ctx, "hib5gorm", "--gorm", "hibernate5")
- then:
- noExceptionThrown()
- out.toString().contains("Application created")
+ then: 'Hibernate 5 support has been removed, so this value no longer resolves'
+ err.toString().contains("Invalid Grails Data implementation selection: hibernate5")
+ !out.toString().contains("Application created")
}
void "community and preview features are labelled as such"() {
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/AsyncGorm.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/AsyncGorm.java
index c752499c0a..62e1b6f968 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/AsyncGorm.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/AsyncGorm.java
@@ -31,7 +31,7 @@ import org.grails.forge.util.VersionInfo;
* Adds the {@code grails-datamapping-async} dependency to the generated application.
*
* <p>Asynchronous Grails Data is a layer on top of GORM rather than a GORM implementation, so
- * this feature is selectable in addition to (not instead of) {@link GrailsDataHibernate5}
+ * this feature is selectable in addition to (not instead of) {@link GrailsDataHibernate7}
* or {@link GrailsDataMongoDB}. If the user opts into asynchronous Grails Data without explicitly
* selecting a GORM persistence layer, Hibernate is added as a sensible default
* via {@link #processSelectedFeatures(FeatureContext)}.</p>
@@ -39,10 +39,10 @@ import org.grails.forge.util.VersionInfo;
@Singleton
public class AsyncGorm implements Feature {
- private final GrailsDataHibernate5 grailsDataHibernate5;
+ private final GrailsDataHibernate7 grailsDataHibernate7;
- public AsyncGorm(GrailsDataHibernate5 grailsDataHibernate5) {
- this.grailsDataHibernate5 = grailsDataHibernate5;
+ public AsyncGorm(GrailsDataHibernate7 grailsDataHibernate7) {
+ this.grailsDataHibernate7 = grailsDataHibernate7;
}
@Override
@@ -75,7 +75,7 @@ public class AsyncGorm implements Feature {
// asynchronous Grails Data needs a GORM implementation to operate on; default to Hibernate
// when the user has not explicitly chosen a GORM provider.
if (!featureContext.isPresent(GormFeature.class) && !featureContext.isPresent(GormOneOfFeature.class)) {
- featureContext.addFeature(grailsDataHibernate5);
+ featureContext.addFeature(grailsDataHibernate7);
}
}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/DatabaseDriverFeature.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/DatabaseDriverFeature.java
index 7d04b11e77..6ea0a7cf2a 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/DatabaseDriverFeature.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/DatabaseDriverFeature.java
@@ -29,15 +29,15 @@ import java.util.Map;
public abstract class DatabaseDriverFeature implements OneOfFeature {
private final TestContainers testContainers;
- private final GrailsDataHibernate5 grailsDataHibernate5;
+ private final GrailsDataHibernate7 grailsDataHibernate7;
public DatabaseDriverFeature() {
this.testContainers = null;
- this.grailsDataHibernate5 = null;
+ this.grailsDataHibernate7 = null;
}
- public DatabaseDriverFeature(GrailsDataHibernate5 grailsDataHibernate5, TestContainers testContainers) {
- this.grailsDataHibernate5 = grailsDataHibernate5;
+ public DatabaseDriverFeature(GrailsDataHibernate7 grailsDataHibernate7, TestContainers testContainers) {
+ this.grailsDataHibernate7 = grailsDataHibernate7;
this.testContainers = testContainers;
}
@@ -56,8 +56,8 @@ public abstract class DatabaseDriverFeature implements OneOfFeature {
if (!featureContext.isPresent(TestContainers.class) && testContainers != null) {
featureContext.addFeature(testContainers);
}
- if (!featureContext.isPresent(DatabaseDriverConfigurationFeature.class) && grailsDataHibernate5 != null) {
- featureContext.addFeature(grailsDataHibernate5);
+ if (!featureContext.isPresent(DatabaseDriverConfigurationFeature.class) && grailsDataHibernate7 != null) {
+ featureContext.addFeature(grailsDataHibernate7);
}
}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate5.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate5.java
deleted file mode 100644
index 7b8ebf8400..0000000000
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate5.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.grails.forge.feature.database;
-
-import io.micronaut.context.annotation.Primary;
-import jakarta.inject.Singleton;
-import org.grails.forge.application.ApplicationType;
-import org.grails.forge.application.generator.GeneratorContext;
-import org.grails.forge.build.dependencies.Dependency;
-import org.grails.forge.feature.Feature;
-import org.grails.forge.feature.FeatureContext;
-import org.grails.forge.options.GormImpl;
-import org.grails.forge.options.Options;
-
-import java.util.Map;
-import java.util.Set;
-
-@Primary
-@Singleton
-public class GrailsDataHibernate5 extends GormFeature implements DatabaseDriverConfigurationFeature {
-
- private static final String URL_KEY = DATASOURCE_PREFIX + "url";
- private static final String DRIVER_KEY = DATASOURCE_PREFIX + "driverClassName";
- private static final String USERNAME_KEY = DATASOURCE_PREFIX + "username";
- private static final String PASSWORD_KEY = DATASOURCE_PREFIX + "password";
- private static final String DB_CREATE_KEY = DATASOURCE_PREFIX + "dbCreate";
-
- private final DatabaseDriverFeature defaultDbFeature;
-
- public GrailsDataHibernate5(DatabaseDriverFeature defaultDbFeature) {
- this.defaultDbFeature = defaultDbFeature;
- }
-
- @Override
- public String getName() {
- return "gorm-hibernate5";
- }
-
- @Override
- public String getTitle() {
- return "Grails Data for Hibernate 5";
- }
-
- @Override
- public String getDescription() {
- return "Configure Grails Data for using Hibernate 5.";
- }
-
- @Override
- public void processSelectedFeatures(FeatureContext featureContext) {
- if (!featureContext.isPresent(DatabaseDriverFeature.class)) {
- featureContext.addFeature(defaultDbFeature);
- }
- }
-
- @Override
- public void apply(GeneratorContext generatorContext) {
- Map<String, Object> config = generatorContext.getConfiguration();
- DatabaseDriverFeature dbFeature = generatorContext.getRequiredFeature(DatabaseDriverFeature.class);
- applyDefaultConfig(dbFeature, config);
- applyDefaultGormConfig(config);
- config.put("dataSource.pooled", true);
- config.put("dataSource.jmxExport", true);
- config.put("hibernate.cache.queries", false);
- config.put("hibernate.cache.use_second_level_cache", false);
- config.put("hibernate.cache.use_query_cache", false);
-
- generatorContext.addBuildscriptDependency(Dependency.builder()
- .groupId("org.apache.grails")
- .artifactId("grails-data-hibernate5")
- .buildSrc());
- generatorContext.addDependency(Dependency.builder()
- .groupId("org.apache.grails")
- .artifactId("grails-data-hibernate5")
- .implementation());
- generatorContext.addDependency(Dependency.builder()
- .groupId("com.zaxxer")
- .artifactId("HikariCP")
- .runtimeOnly());
- }
-
- @Override
- public String getUrlKey() {
- return URL_KEY;
- }
-
- @Override
- public String getDriverKey() {
- return DRIVER_KEY;
- }
-
- @Override
- public String getUsernameKey() {
- return USERNAME_KEY;
- }
-
- @Override
- public String getPasswordKey() {
- return PASSWORD_KEY;
- }
-
- @Override
- public String getDbCreateKey() {
- return DB_CREATE_KEY;
- }
-
- @Override
- public boolean shouldApply(ApplicationType applicationType, Options options, Set<Feature> selectedFeatures) {
- return selectedFeatures.stream().anyMatch(f -> f instanceof GrailsDataHibernate5)
- || (options.getGormImpl() == GormImpl.HIBERNATE5
- && selectedFeatures.stream().noneMatch(GrailsDataHibernate7.class::isInstance));
- }
-}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate7.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate7.java
index 4fb30ce28b..a75e262d9f 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate7.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernate7.java
@@ -18,6 +18,7 @@
*/
package org.grails.forge.feature.database;
+import io.micronaut.context.annotation.Primary;
import jakarta.inject.Singleton;
import org.grails.forge.application.ApplicationType;
import org.grails.forge.application.generator.GeneratorContext;
@@ -30,6 +31,7 @@ import org.grails.forge.options.Options;
import java.util.Map;
import java.util.Set;
+@Primary
@Singleton
public class GrailsDataHibernate7 extends GormFeature implements DatabaseDriverConfigurationFeature {
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernateValidator.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernateValidator.java
deleted file mode 100644
index ce9db88429..0000000000
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GrailsDataHibernateValidator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.grails.forge.feature.database;
-
-import java.util.Set;
-
-import jakarta.inject.Singleton;
-
-import org.grails.forge.application.ApplicationType;
-import org.grails.forge.feature.Feature;
-import org.grails.forge.feature.validation.FeatureValidator;
-import org.grails.forge.options.Options;
-
-@Singleton
-public class GrailsDataHibernateValidator implements FeatureValidator {
-
- @Override
- public void validatePreProcessing(Options options, ApplicationType applicationType, Set<Feature> features) {
- validateOnlyOneHibernateImplementation(features);
- }
-
- @Override
- public void validatePostProcessing(Options options, ApplicationType applicationType, Set<Feature> features) {
- validateOnlyOneHibernateImplementation(features);
- }
-
- private static void validateOnlyOneHibernateImplementation(Set<Feature> features) {
- if (features.stream().anyMatch(GrailsDataHibernate5.class::isInstance)
- && features.stream().anyMatch(GrailsDataHibernate7.class::isInstance)) {
- throw new IllegalArgumentException("Only one Grails Data for Hibernate implementation can be selected: gorm-hibernate5 or gorm-hibernate7");
- }
- }
-}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GraphqlGorm.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GraphqlGorm.java
index 81650a688f..e75bd3dd86 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GraphqlGorm.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/GraphqlGorm.java
@@ -31,7 +31,7 @@ import org.grails.forge.feature.FeatureContext;
* Adds the {@code grails-data-graphql} plugin to the generated application.
*
* <p>GraphQL is a layer on top of GORM rather than a GORM implementation, so
- * this feature is selectable in addition to (not instead of) {@link GrailsDataHibernate5}
+ * this feature is selectable in addition to (not instead of) {@link GrailsDataHibernate7}
* or {@link GrailsDataMongoDB}. If the user opts into GraphQL without explicitly
* selecting a GORM persistence layer, Hibernate is added as a sensible default
* via {@link #processSelectedFeatures(FeatureContext)}.</p>
@@ -39,10 +39,10 @@ import org.grails.forge.feature.FeatureContext;
@Singleton
public class GraphqlGorm implements Feature {
- private final GrailsDataHibernate5 grailsDataHibernate5;
+ private final GrailsDataHibernate7 grailsDataHibernate7;
- public GraphqlGorm(GrailsDataHibernate5 grailsDataHibernate5) {
- this.grailsDataHibernate5 = grailsDataHibernate5;
+ public GraphqlGorm(GrailsDataHibernate7 grailsDataHibernate7) {
+ this.grailsDataHibernate7 = grailsDataHibernate7;
}
@Override
@@ -75,7 +75,7 @@ public class GraphqlGorm implements Feature {
// GraphQL needs a GORM implementation to introspect; default to Hibernate
// when the user has not explicitly chosen a GORM provider.
if (!featureContext.isPresent(GormFeature.class) && !featureContext.isPresent(GormOneOfFeature.class)) {
- featureContext.addFeature(grailsDataHibernate5);
+ featureContext.addFeature(grailsDataHibernate7);
}
}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/H2.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/H2.java
index 5cf1b5ac16..2f01a773df 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/H2.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/H2.java
@@ -100,7 +100,7 @@ public class H2 extends DatabaseDriverFeature implements DefaultFeature {
@Override
public boolean shouldApply(ApplicationType applicationType, Options options, Set<Feature> selectedFeatures) {
- return (options.getGormImpl() == GormImpl.HIBERNATE5 || options.getGormImpl() == GormImpl.HIBERNATE7) &&
+ return options.getGormImpl() == GormImpl.HIBERNATE7 &&
selectedFeatures.stream().noneMatch(f -> f instanceof DatabaseDriverFeature);
}
}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/MySQL.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/MySQL.java
index 88fef13f8f..b95232d5a0 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/MySQL.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/MySQL.java
@@ -26,8 +26,8 @@ import org.grails.forge.build.dependencies.Dependency;
@Singleton
public class MySQL extends DatabaseDriverFeature {
- public MySQL(GrailsDataHibernate5 grailsDataHibernate5, TestContainers testContainers) {
- super(grailsDataHibernate5, testContainers);
+ public MySQL(GrailsDataHibernate7 grailsDataHibernate7, TestContainers testContainers) {
+ super(grailsDataHibernate7, testContainers);
}
@Override
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/PostgreSQL.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/PostgreSQL.java
index 0858a412b7..d6347c1603 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/PostgreSQL.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/PostgreSQL.java
@@ -26,8 +26,8 @@ import org.grails.forge.build.dependencies.Dependency;
@Singleton
public class PostgreSQL extends DatabaseDriverFeature {
- public PostgreSQL(GrailsDataHibernate5 grailsDataHibernate5, TestContainers testContainers) {
- super(grailsDataHibernate5, testContainers);
+ public PostgreSQL(GrailsDataHibernate7 grailsDataHibernate7, TestContainers testContainers) {
+ super(grailsDataHibernate7, testContainers);
}
@Override
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/SQLServer.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/SQLServer.java
index 242c6a0cf0..4d781d2458 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/SQLServer.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/database/SQLServer.java
@@ -26,8 +26,8 @@ import org.grails.forge.build.dependencies.Dependency;
@Singleton
public class SQLServer extends DatabaseDriverFeature {
- public SQLServer(GrailsDataHibernate5 grailsDataHibernate5, TestContainers testContainers) {
- super(grailsDataHibernate5, testContainers);
+ public SQLServer(GrailsDataHibernate7 grailsDataHibernate7, TestContainers testContainers) {
+ super(grailsDataHibernate7, testContainers);
}
@Override
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/grails/GrailsBase.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/grails/GrailsBase.java
index ae4df33112..cc8da57f50 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/grails/GrailsBase.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/grails/GrailsBase.java
@@ -59,8 +59,9 @@ public class GrailsBase implements DefaultFeature {
// When Micronaut is used, the application must consume the Micronaut BOM variant as an
// enforcedPlatform so the Micronaut platform cannot override the Grails BOM. The
- // Hibernate 7 BOM variants pin the Hibernate 7 dependency versions (e.g. jandex) that
- // conflict with the default (Hibernate 5) grails-bom - see grails-core issue #15942.
+ // Hibernate 7 BOM variants pin Hibernate 7 dependency versions (e.g. jandex) that the
+ // plain default grails-bom (used by apps with no Hibernate feature, e.g. MongoDB/Neo4j
+ // only) does not manage - see grails-core issue #15942.
boolean useMicronautBom = generatorContext.isFeaturePresent(GrailsMicronaut.class);
boolean useHibernate7Bom = generatorContext.isFeaturePresent(GrailsDataHibernate7.class);
String bomArtifactId;
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/migration/DatabaseMigrationPlugin.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/migration/DatabaseMigrationPlugin.java
index f5cb60934a..554cde81de 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/migration/DatabaseMigrationPlugin.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/migration/DatabaseMigrationPlugin.java
@@ -21,7 +21,6 @@ package org.grails.forge.feature.migration;
import jakarta.inject.Singleton;
import org.grails.forge.application.generator.GeneratorContext;
import org.grails.forge.build.dependencies.Dependency;
-import org.grails.forge.feature.database.GrailsDataHibernate7;
import org.grails.forge.feature.migration.templates.dbMigrationGradle;
import org.grails.forge.template.RockerWritable;
import org.grails.forge.template.URLTemplate;
@@ -52,7 +51,7 @@ public class DatabaseMigrationPlugin implements MigrationFeature {
@Override
public String getDocumentation() {
- return "https://grails.apache.org/docs/" + VersionInfo.getDocumentationVersion() + "/grails-data/hibernate5/manual/index.html#databaseMigration";
+ return "https://grails.apache.org/docs/" + VersionInfo.getDocumentationVersion() + "/grails-data/hibernate7/manual/index.html#databaseMigration";
}
@Override
@@ -61,12 +60,9 @@ public class DatabaseMigrationPlugin implements MigrationFeature {
// the dbm-* commands ship in the companion -cli artifact, which the Grails Gradle plugin
// discovers automatically from the plugin jar's Grails-Cli-Artifact manifest attribute —
// no buildscript classpath or grailsCli entry is generated
- final String dbMigrationArtifactId = generatorContext.isFeaturePresent(GrailsDataHibernate7.class)
- ? "grails-data-hibernate7-dbmigration"
- : "grails-data-hibernate5-dbmigration";
generatorContext.addDependency(Dependency.builder()
.groupId("org.apache.grails")
- .artifactId(dbMigrationArtifactId)
+ .artifactId("grails-data-hibernate7-dbmigration")
.implementation()
.extension(new RockerWritable(dbMigrationGradle.template(srcDirPath))));
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/user.rocker.raw b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/user.rocker.raw
index 4a29d29404..0de93fbfe1 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/user.rocker.raw
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/user.rocker.raw
@@ -44,7 +44,7 @@ class User implements UserDetails {
collection 'users'
}
-} else if (features.contains("gorm-hibernate5") || features.contains("gorm-hibernate7")) {
+} else if (features.contains("gorm-hibernate7")) {
static mapping = {
table 'users'
}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/userClassic.rocker.raw b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/userClassic.rocker.raw
index 75d358f0a1..1df7d92153 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/userClassic.rocker.raw
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/security/template/userClassic.rocker.raw
@@ -58,7 +58,7 @@ class User implements Serializable {
collection 'user'
}
-} else if (features.contains("gorm-hibernate5") || features.contains("gorm-hibernate7")) {
+} else if (features.contains("gorm-hibernate7")) {
static mapping = {
table name: '`user`'
}
diff --git a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/options/GormImpl.java b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/options/GormImpl.java
index 35af957cf5..5c6bed795d 100644
--- a/grails-forge/grails-forge-core/src/main/java/org/grails/forge/options/GormImpl.java
+++ b/grails-forge/grails-forge-core/src/main/java/org/grails/forge/options/GormImpl.java
@@ -23,14 +23,15 @@ import io.micronaut.core.annotation.Nullable;
public enum GormImpl {
- HIBERNATE5("gorm-hibernate5", "Hibernate 5"),
HIBERNATE7("gorm-hibernate7", "Hibernate 7"),
MONGODB("gorm-mongodb", "MongoDB"),
NEO4J("gorm-neo4j", "Neo4j");
- public static final GormImpl DEFAULT_OPTION = HIBERNATE5;
+ public static final GormImpl DEFAULT_OPTION = HIBERNATE7;
- // Selection value accepted before HIBERNATE5 replaced the HIBERNATE constant
+ // Selection value accepted before HIBERNATE7 replaced the HIBERNATE constant.
+ // Hibernate 5 support has been removed from Grails; this legacy value now
+ // resolves to HIBERNATE7 rather than the withdrawn Hibernate 5 implementation.
private static final String LEGACY_HIBERNATE_VALUE = "hibernate";
private final String featureName;
@@ -54,8 +55,8 @@ public enum GormImpl {
/**
* Resolves a user-supplied selection value to a {@link GormImpl}.
*
- * @param value the selection value (case-insensitive), e.g. {@code hibernate5};
- * the legacy value {@code hibernate} resolves to {@link #HIBERNATE5}
+ * @param value the selection value (case-insensitive), e.g. {@code hibernate7};
+ * the legacy value {@code hibernate} resolves to {@link #HIBERNATE7}
* @return the matching implementation, or {@code null} when the value is unknown
*/
@Nullable
@@ -64,7 +65,7 @@ public enum GormImpl {
return null;
}
if (LEGACY_HIBERNATE_VALUE.equalsIgnoreCase(value)) {
- return HIBERNATE5;
+ return HIBERNATE7;
}
for (GormImpl impl : values()) {
if (value.equalsIgnoreCase(impl.name())) {
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/BuildBuilder.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/BuildBuilder.groovy
index 3a2cfa91fd..0d194198af 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/BuildBuilder.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/BuildBuilder.groovy
@@ -128,7 +128,7 @@ class BuildBuilder implements ProjectFixture, ContextFixture {
Project project = this.project ?: buildProject()
JdkVersion jdkVersion = this.jdkVersion ?: JdkVersion.DEFAULT_OPTION
- Options options = new Options(reloading, jdkVersion)
+ Options options = new Options(reloading, gormImpl, servletImpl, jdkVersion, operatingSystem)
Features features = getFeatures(featureNames, options, type)
String grailsVersion = VersionInfo.grailsVersion
GradleBuild build = gradleBuild(options, features, project, type)
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/AsyncGormSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/AsyncGormSpec.groovy
index 9635b606ff..c4b11dfee8 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/AsyncGormSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/AsyncGormSpec.groovy
@@ -41,13 +41,13 @@ class AsyncGormSpec extends ApplicationContextSpec implements CommandOutputFixtu
features.contains('gorm-async')
}
- void "test gorm-async defaults to gorm-hibernate5 when no GORM impl is selected"() {
+ void "test gorm-async defaults to gorm-hibernate7 when no GORM impl is selected"() {
when:
Features features = getFeatures(['gorm-async'])
then: 'async alone falls back to Hibernate as the GORM impl'
features.contains('gorm-async')
- features.contains('gorm-hibernate5')
+ features.contains('gorm-hibernate7')
}
void "test gorm-async is selectable alongside gorm-mongodb"() {
@@ -63,7 +63,7 @@ class AsyncGormSpec extends ApplicationContextSpec implements CommandOutputFixtu
then: 'async is layered on top of MongoDB without forcing Hibernate'
features.contains('gorm-async')
features.contains('gorm-mongodb')
- !features.contains('gorm-hibernate5')
+ !features.contains('gorm-hibernate7')
}
void "test gorm-async category is Database"() {
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate5Spec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate5Spec.groovy
deleted file mode 100644
index 7aae8c4a2d..0000000000
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate5Spec.groovy
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.grails.forge.feature.database
-
-import groovy.yaml.YamlSlurper
-import org.grails.forge.ApplicationContextSpec
-import org.grails.forge.BuildBuilder
-import org.grails.forge.application.ApplicationType
-import org.grails.forge.application.generator.GeneratorContext
-import org.grails.forge.feature.Features
-import org.grails.forge.fixture.CommandOutputFixture
-import org.grails.forge.options.DevelopmentReloading
-import org.grails.forge.options.JdkVersion
-import org.grails.forge.options.Options
-import org.grails.forge.options.TestFramework
-
-class GrailsDataHibernate5Spec extends ApplicationContextSpec implements CommandOutputFixture{
-
- void "test hibernate gorm features"() {
- when:
- Features features = getFeatures(['gorm-hibernate5'])
-
- then:
- features.contains("h2")
- features.contains("gorm-hibernate5")
- }
-
- void "test dependencies are present for gradle"() {
- when:
- final String template = new BuildBuilder(beanContext)
- .features(["gorm-hibernate5"])
- .render()
-
- then:
- template.contains('implementation "org.apache.grails:grails-data-hibernate5"')
- template.contains('runtimeOnly "com.zaxxer:HikariCP"')
- template.contains('runtimeOnly "com.h2database:h2"')
- }
-
- void "test dependencies are present for buildSrc"() {
- when:
- final String template = new BuildBuilder(beanContext)
- .features(["gorm-hibernate5"])
- .renderBuildSrc()
-
- then:
- template.contains('implementation "org.apache.grails:grails-data-hibernate5"')
- }
-
- void "test buildSrc is present for buildscript dependencies"() {
- given:
- final def output = generate(ApplicationType.WEB, new Options(DevelopmentReloading.DEVTOOLS))
- final def buildGradle = output["build.gradle"]
-
- expect:
- buildGradle != null
- buildGradle.contains("classpath \"org.apache.grails:grails-data-hibernate5\"")
-
- }
-
- void "test config"() {
- when:
- GeneratorContext ctx = buildGeneratorContext(['gorm-hibernate5'])
-
- then:
- ctx.configuration.containsKey("dataSource.pooled")
- ctx.configuration.containsKey("dataSource.jmxExport")
- ctx.configuration.containsKey("hibernate.cache.queries")
- ctx.configuration.containsKey("hibernate.cache.use_second_level_cache")
- ctx.configuration.containsKey("hibernate.cache.use_query_cache")
- }
-
- void "test match values of datasource config"() {
-
- when:
- final def output = generate(ApplicationType.WEB, new Options(DevelopmentReloading.DEVTOOLS))
- final String applicationYaml = output["grails-app/conf/application.yml"]
- def config = new YamlSlurper().parseText(applicationYaml)
-
- then:
- config.environments.development.dataSource.dbCreate == 'create-drop'
- config.environments.test.dataSource.dbCreate == 'update'
- config.environments.production.dataSource.dbCreate == 'none'
- config.environments.development.dataSource.url == 'jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE'
- config.environments.test.dataSource.url == 'jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE'
- config.environments.production.dataSource.url == 'jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE'
- }
-}
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate7Spec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate7Spec.groovy
index d27b2e9e32..db6165a61e 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate7Spec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataHibernate7Spec.groovy
@@ -125,7 +125,8 @@ class GrailsDataHibernate7Spec extends ApplicationContextSpec implements Command
void "test buildSrc uses the micronaut bom when micronaut is added without hibernate 7"() {
when:
final String template = new BuildBuilder(beanContext)
- .features(["gorm-hibernate5", "grails-micronaut"])
+ .features(["gorm-mongodb", "grails-micronaut"])
+ .gormImpl(GormImpl.MONGODB)
.jdkVersion(JdkVersion.JDK_25)
.renderBuildSrc()
@@ -135,10 +136,11 @@ class GrailsDataHibernate7Spec extends ApplicationContextSpec implements Command
!template.contains('org.apache.grails:grails-bom:')
}
- void "test hibernate 5 micronaut bom is used when micronaut is added without hibernate 7"() {
+ void "test micronaut bom is used when micronaut is added without hibernate 7"() {
when:
final String template = new BuildBuilder(beanContext)
- .features(["gorm-hibernate5", "grails-micronaut"])
+ .features(["gorm-mongodb", "grails-micronaut"])
+ .gormImpl(GormImpl.MONGODB)
.jdkVersion(JdkVersion.JDK_25)
.render()
@@ -182,13 +184,13 @@ class GrailsDataHibernate7Spec extends ApplicationContextSpec implements Command
!template.contains('grails-data-hibernate5-dbmigration')
}
- void "test selecting both hibernate implementations is rejected"() {
+ void "test gorm-hibernate5 is no longer a selectable feature"() {
when:
- getFeatures(['gorm-hibernate5', 'gorm-hibernate7'])
+ getFeatures(['gorm-hibernate5'])
then:
IllegalArgumentException e = thrown()
- e.message.contains('Only one Grails Data for Hibernate implementation can be selected')
+ e.message.contains('The requested feature does not exist: gorm-hibernate5')
}
void "test config"() {
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataMongoDBSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataMongoDBSpec.groovy
index 5f3dc3a8f2..22d8a3cc8e 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataMongoDBSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GrailsDataMongoDBSpec.groovy
@@ -99,7 +99,7 @@ class GrailsDataMongoDBSpec extends ApplicationContextSpec implements CommandOut
!output.containsKey('src/main/resources/META-INF/spring.factories')
}
- void "test a SQL driver combined with MongoDB still adds Hibernate 5 as the default SQL implementation"() {
+ void "test a SQL driver combined with MongoDB still adds Hibernate 7 as the default SQL implementation"() {
given:
Options options = new Options(DevelopmentReloading.DEFAULT_OPTION, GormImpl.MONGODB, ServletImpl.DEFAULT_OPTION, JdkVersion.DEFAULT_OPTION)
@@ -109,8 +109,7 @@ class GrailsDataMongoDBSpec extends ApplicationContextSpec implements CommandOut
then:
features.contains("gorm-mongodb")
features.contains("postgres")
- features.contains("gorm-hibernate5")
- !features.contains("gorm-hibernate7")
+ features.contains("gorm-hibernate7")
when:
String template = new BuildBuilder(beanContext)
@@ -120,7 +119,7 @@ class GrailsDataMongoDBSpec extends ApplicationContextSpec implements CommandOut
then:
template.contains("implementation \"org.apache.grails:grails-data-mongodb\"")
- template.contains("implementation \"org.apache.grails:grails-data-hibernate5\"")
+ template.contains("implementation \"org.apache.grails:grails-data-hibernate7\"")
template.contains("runtimeOnly \"org.postgresql:postgresql\"")
when:
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GraphqlGormSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GraphqlGormSpec.groovy
index 6bd6b6259f..693bac6f0b 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GraphqlGormSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/GraphqlGormSpec.groovy
@@ -42,13 +42,13 @@ class GraphqlGormSpec extends ApplicationContextSpec implements CommandOutputFix
features.contains('gorm-graphql')
}
- void "test gorm-graphql defaults to gorm-hibernate5 when no GORM impl is selected"() {
+ void "test gorm-graphql defaults to gorm-hibernate7 when no GORM impl is selected"() {
when:
Features features = getFeatures(['gorm-graphql'])
then: 'GraphQL alone falls back to Hibernate as the GORM impl'
features.contains('gorm-graphql')
- features.contains('gorm-hibernate5')
+ features.contains('gorm-hibernate7')
}
void "test gorm-graphql is selectable alongside gorm-mongodb"() {
@@ -64,7 +64,7 @@ class GraphqlGormSpec extends ApplicationContextSpec implements CommandOutputFix
then: 'GraphQL is layered on top of MongoDB without forcing Hibernate'
features.contains('gorm-graphql')
features.contains('gorm-mongodb')
- !features.contains('gorm-hibernate5')
+ !features.contains('gorm-hibernate7')
}
void "test gorm-graphql category is API"() {
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/MySQLSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/MySQLSpec.groovy
index ab3df9414a..49c5a94c0b 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/MySQLSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/MySQLSpec.groovy
@@ -46,7 +46,7 @@ class MySQLSpec extends ApplicationContextSpec {
void "test config"() {
when:
- GeneratorContext ctx = buildGeneratorContext(["gorm-hibernate5", "mysql"])
+ GeneratorContext ctx = buildGeneratorContext(["gorm-hibernate7", "mysql"])
then:
ctx.getConfiguration().get("dataSource.driverClassName") == 'com.mysql.cj.jdbc.Driver'
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/PostgresSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/PostgresSpec.groovy
index c35cc742a3..7b50df3c73 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/PostgresSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/PostgresSpec.groovy
@@ -46,7 +46,7 @@ class PostgresSpec extends ApplicationContextSpec {
void "test config"() {
when:
- GeneratorContext ctx = buildGeneratorContext(["gorm-hibernate5", "postgres"])
+ GeneratorContext ctx = buildGeneratorContext(["gorm-hibernate7", "postgres"])
then:
ctx.getConfiguration().get("dataSource.driverClassName") == 'org.postgresql.Driver'
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/SQLServerSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/SQLServerSpec.groovy
index 826babefbd..34288aa761 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/SQLServerSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/database/SQLServerSpec.groovy
@@ -46,7 +46,7 @@ class SQLServerSpec extends ApplicationContextSpec {
void "test config"() {
when:
- GeneratorContext ctx = buildGeneratorContext(["gorm-hibernate5", "sqlserver"])
+ GeneratorContext ctx = buildGeneratorContext(["gorm-hibernate7", "sqlserver"])
then:
ctx.getConfiguration().get("dataSource.driverClassName") == 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/migration/DatabaseMigrationPluginSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/migration/DatabaseMigrationPluginSpec.groovy
index 83dbde3e30..e0e2c6f206 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/migration/DatabaseMigrationPluginSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/migration/DatabaseMigrationPluginSpec.groovy
@@ -37,8 +37,8 @@ class DatabaseMigrationPluginSpec extends ApplicationContextSpec implements Comm
.render()
then: 'only the runtime plugin is declared — its -cli companion is auto-discovered by the Grails Gradle plugin'
- template.contains('implementation "org.apache.grails:grails-data-hibernate5-dbmigration"')
- !template.contains('grails-data-hibernate5-dbmigration-cli')
+ template.contains('implementation "org.apache.grails:grails-data-hibernate7-dbmigration"')
+ !template.contains('grails-data-hibernate7-dbmigration-cli')
}
void "test the cli companion is not declared in buildSrc"() {
@@ -48,7 +48,7 @@ class DatabaseMigrationPluginSpec extends ApplicationContextSpec implements Comm
.renderBuildSrc()
then:
- !template.contains('grails-data-hibernate5-dbmigration')
+ !template.contains('grails-data-hibernate7-dbmigration')
}
void "test the generated application declares only the runtime plugin"() {
@@ -58,8 +58,8 @@ class DatabaseMigrationPluginSpec extends ApplicationContextSpec implements Comm
expect:
buildGradle != null
- buildGradle.contains('implementation "org.apache.grails:grails-data-hibernate5-dbmigration"')
- !buildGradle.contains('grails-data-hibernate5-dbmigration-cli')
+ buildGradle.contains('implementation "org.apache.grails:grails-data-hibernate7-dbmigration"')
+ !buildGradle.contains('grails-data-hibernate7-dbmigration-cli')
}
@Unroll
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/GrailsSpringSecuritySpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/GrailsSpringSecuritySpec.groovy
index e5a322c93f..2bd147c8fb 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/GrailsSpringSecuritySpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/GrailsSpringSecuritySpec.groovy
@@ -93,7 +93,6 @@ class GrailsSpringSecuritySpec extends ApplicationContextSpec implements Command
where:
gorm | directive | foreign
- GormImpl.HIBERNATE5 | "table name: '`user`'" | "collection 'user'"
GormImpl.HIBERNATE7 | "table name: '`user`'" | "collection 'user'"
GormImpl.MONGODB | "collection 'user'" | "table name: '`user`'"
}
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/SpringBootStarterSecuritySpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/SpringBootStarterSecuritySpec.groovy
index 7581ec32cc..6b21f5ceb6 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/SpringBootStarterSecuritySpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/security/SpringBootStarterSecuritySpec.groovy
@@ -122,7 +122,6 @@ class SpringBootStarterSecuritySpec extends ApplicationContextSpec implements Co
where:
gorm | directive | foreign
- GormImpl.HIBERNATE5 | "table 'users'" | "collection 'users'"
GormImpl.HIBERNATE7 | "table 'users'" | "collection 'users'"
GormImpl.MONGODB | "collection 'users'" | "table 'users'"
}
diff --git a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/options/GormImplSpec.groovy b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/options/GormImplSpec.groovy
index af407d63d5..f603632532 100644
--- a/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/options/GormImplSpec.groovy
+++ b/grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/options/GormImplSpec.groovy
@@ -31,18 +31,22 @@ class GormImplSpec extends Specification {
where:
value | expected
- 'hibernate5' | GormImpl.HIBERNATE5
- 'HIBERNATE5' | GormImpl.HIBERNATE5
- 'hibernate' | GormImpl.HIBERNATE5
- 'HIBERNATE' | GormImpl.HIBERNATE5
+ 'hibernate' | GormImpl.HIBERNATE7
+ 'HIBERNATE' | GormImpl.HIBERNATE7
'hibernate7' | GormImpl.HIBERNATE7
+ 'HIBERNATE7' | GormImpl.HIBERNATE7
'mongodb' | GormImpl.MONGODB
'neo4j' | GormImpl.NEO4J
null | null
}
- void "the default option is Hibernate 5"() {
+ void "hibernate5 is no longer a resolvable value"() {
+ expect: 'Hibernate 5 support has been removed, so this value is now unresolvable'
+ GormImpl.parse('hibernate5') == null
+ }
+
+ void "the default option is Hibernate 7"() {
expect:
- GormImpl.DEFAULT_OPTION == GormImpl.HIBERNATE5
+ GormImpl.DEFAULT_OPTION == GormImpl.HIBERNATE7
}
}