Skip to content

Commit

Permalink
Remove gorm from docs and version catalog (#10696)
Browse files Browse the repository at this point in the history
* Remove GORM from docs (unsupported in Micronaut Framework 4)

closes #10689

* Remove GORM from version catalog (unsupported in Micronaut Framework 4)
  • Loading branch information
wetted authored Apr 10, 2024
1 parent 41d8dfc commit bf9792c
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 81 deletions.
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ caffeine = "2.9.3"
compile-testing = "0.21.0"

geb = "7.0"
gorm = "7.3.4"
# be sure to update graal version in gradle.properties as well
graal-svm = "23.1.2"
h2 = "2.2.224"
Expand Down Expand Up @@ -175,7 +174,6 @@ caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "c
compile-testing = { module = "com.google.testing.compile:compile-testing", version.ref = "compile-testing" }

geb-spock = { module = "org.gebish:geb-spock", version.ref = "geb" }
gorm = { module = "org.grails:grails-datastore-core", version.ref = "gorm" }
graal = { module = "org.graalvm.nativeimage:svm", version.ref = "graal-svm" }
groovy-test-junit5 = { module = "org.apache.groovy:groovy-test-junit5", version.ref = "managed-groovy" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ public interface Environment extends PropertyResolver, LifeCycle<Environment>, M
Environment removePropertySource(PropertySource propertySource);

/**
* Add an application package. Application packages are candidates for scanning for tools that need it (such as JPA
* or GORM).
* Add an application package. Application packages are candidates for scanning for tools that need it (such as JPA).
*
* @param pkg The package to add
* @return This environment
Expand Down Expand Up @@ -294,8 +293,7 @@ default Environment addPropertySource(String name, @Nullable Map<String, ? super
}

/**
* Add an application package. Application packages are candidates for scanning for tools that need it (such as JPA
* or GORM).
* Add an application package. Application packages are candidates for scanning for tools that need it (such as JPA).
*
* @param pkg The package to add
* @return This environment
Expand Down
2 changes: 1 addition & 1 deletion src/main/docs/guide/aop/introductionAdvice.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Introduction advice is distinct from Around advice in that it involves providing an implementation instead of decorating.

Examples of introduction advice include https://gorm.grails.org[GORM] and https://spring.io/projects/spring-data/[Spring Data] which implement persistence logic for you.
Examples of introduction advice includes https://spring.io/projects/spring-data/[Spring Data] which implements persistence logic for you.

Micronaut api:http.client.annotation.Client[] annotation is another example of introduction advice where the Micronaut framework implements HTTP client interfaces for you at compile time.

Expand Down
4 changes: 2 additions & 2 deletions src/main/docs/guide/cli/createProject.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ The create-* commands generate a basic Micronaut project, with optional flags to
a|
[source,bash]
----
--features security-jwt,mongo-gorm
--features security-jwt,mongo-reactive
----
or
[source,bash]
----
-f security-jwt -f mongo-gorm
-f security-jwt -f mongo-reactive
----

|`-i`, `--inplace`
Expand Down
13 changes: 0 additions & 13 deletions src/main/docs/guide/configurations/dataAccess.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,12 @@ This table summarizes the configuration modules and dependencies to add to your
|`io.micronaut.sql:micronaut-hibernate-jpa`
|Configures Hibernate/JPA `EntityManagerFactory` beans

|`io.micronaut.groovy:micronaut-hibernate-gorm`
|Configures https://gorm.grails.org/latest/hibernate/manual[GORM for Hibernate] for Groovy applications

|`io.micronaut.mongodb:micronaut-mongo-reactive`
|Configures the https://mongodb.github.io/mongo-java-driver-reactivestreams[MongoDB Reactive Driver]

|`io.micronaut.groovy:micronaut-mongo-gorm`
|Configures https://gorm.grails.org/latest/mongodb/manual[GORM for MongoDB] for Groovy applications

|`io.micronaut.neo4j:micronaut-neo4j-bolt`
|Configures the https://github.com/neo4j/neo4j-java-driver[Bolt Java Driver] for https://neo4j.com[Neo4j]

|`io.micronaut.groovy:micronaut-neo4j-gorm`
|Configures https://gorm.grails.org/latest/neo4j/manual[GORM for Neo4j] for Groovy applications

|`io.micronaut.sql:micronaut-vertx-mysql-client`
|Configures the https://github.com/eclipse-vertx/vertx-sql-client/tree/master/vertx-mysql-client[Reactive MySQL Client]

Expand All @@ -53,8 +44,4 @@ For example, to add support for MongoDB, add the following dependency:
compile "io.micronaut.mongodb:micronaut-mongo-reactive"
----

For Groovy users, the Micronaut framework provides special support for https://gorm.grails.org[GORM].

WARNING: With GORM for Hibernate you cannot have both the `hibernate-jpa` and `hibernate-gorm` dependencies.

The following sections go into more detail about configuration options and the exposed beans for each implementation.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,3 @@ Once you have <<sqlSupport, configured one or more DataSources>> to use Hibernat
dependency:micronaut-hibernate-jpa[groupId="io.micronaut.sql"]

For more information see the https://micronaut-projects.github.io/micronaut-sql/latest/guide/#hibernate[Configuring Hibernate] section of the https://github.com/micronaut-projects/micronaut-sql[Micronaut SQL libraries] project.

==== Using GORM for Hibernate

For Groovy users and users familiar with the Grails framework, special support for https://gorm.grails.org[GORM for Hibernate] is available. To use GORM for Hibernate *do not* include Micronaut's built-in <<sqlSupport, SQL Support>> or the `hibernate-jpa` dependency since GORM itself takes responsibility for creating the `DataSource`, `SessionFactory`, etc.

[TIP]
.Using the CLI
====
If you create your project using the Micronaut CLI, supply the `hibernate-gorm` feature to include GORM, a basic connection pool configuration, and a default H2 database driver in your project:
----
$ mn create-app my-app --features hibernate-gorm
----
====

See the https://micronaut-projects.github.io/micronaut-groovy/latest/guide/#gorm[GORM Modules] section of the https://github.com/micronaut-projects/micronaut-groovy[Micronaut Groovy user guide].
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ The Micronaut framework ships with several built-in handlers:
| api:http.server.exceptions.UnsatisfiedArgumentHandler[]
| api:web.router.exceptions.UnsatisfiedRouteException[]
| api:http.server.exceptions.UnsatisfiedRouteHandler[]
| `org.grails.datastore.mapping.validation.ValidationException`
| link:{micronautgroovyapi}/io/micronaut/configuration/gorm/validation/ValidationExceptionHandler.html[ValidationExceptionHandler]
|===
42 changes: 0 additions & 42 deletions src/main/docs/guide/languageSupport/groovy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -163,48 +163,6 @@ The above example results in the following routes:
* `/book/{id}` - Maps to `BookController.show(String id)`
* `/book/{id}/author` - Maps to `AuthorController.index`

== Using GORM in a Groovy application

https://gorm.grails.org[GORM] is a data access toolkit originally created as part of Grails. It supports multiple database types. The following table summarizes the modules needed to use GORM, and links to documentation.

.GORM Modules
|===
|Dependency|Description

|`io.micronaut.groovy:micronaut-hibernate-gorm`
|Configures https://gorm.grails.org/latest/hibernate/manual[GORM for Hibernate] for Groovy applications. See the <<hibernateSupport, Hibernate Support>> docs

|`io.micronaut.groovy:micronaut-mongo-gorm`
|Configures https://gorm.grails.org/latest/mongodb/manual[GORM for MongoDB] for Groovy applications. See the <<mongoSupport, Mongo Support>> docs.

|`io.micronaut.groovy:micronaut-neo4j-gorm`
|Configures https://gorm.grails.org/latest/neo4j/manual[GORM for Neo4j] for Groovy applications. See the <<neo4jSupport, Neo4j Support>> docs.

|===

Once you have configured a GORM implementation per the instructions linked in the table above you can use all features of GORM.

https://gorm.grails.org/latest/hibernate/manual/index.html#dataServices[GORM Data Services] can also participate in dependency injection and life cycle methods:

[source,groovy]
.GORM Data Service VehicleService.groovy
----
@Service(Vehicle)
abstract class VehicleService {
@PostConstruct
void init() {
// do something on initialization
}
abstract Vehicle findVehicle(@NotBlank String name)
abstract Vehicle saveVehicle(@NotBlank String name)
}
----

You can also define the service as an interface instead of an abstract class to have GORM implement the methods for you.

== Serverless Functions with Groovy

A microservice application is just one way to use Micronaut. You can also use it for serverless functions like on AWS Lambda.
Expand Down

0 comments on commit bf9792c

Please sign in to comment.