You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: grails-doc/src/en/guide/upgrading/upgrading60x.adoc
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -861,7 +861,53 @@ The `+` marker is opt-in and fully backward compatible:
861
861
- No changes are required to existing applications
862
862
- The feature can be adopted incrementally on a per-mapping basis
863
863
864
-
===== 12.28 Enhanced Audit Metadata Support
864
+
===== 12.28 GormService API Changes
865
+
866
+
The `grails.plugin.scaffolding.GormService` class has been updated to fix a thread-safety issue and improve API clarity.
867
+
868
+
====== Changes
869
+
870
+
1. The `resource` field type changed from `GormAllOperations<T>` to `Class<T>`
871
+
2. A new `gormStaticApi` field of type `GormAllOperations<T>` was added with thread-safe lazy initialization using `@Lazy`
872
+
3. The constructor no longer instantiates the resource class - it now stores the Class reference directly
873
+
874
+
====== Migration Impact
875
+
876
+
If your code extends `GormService` or accesses its fields:
877
+
878
+
**Accessing GORM operations**: Previously the `resource` field provided GORM operations. Now use the `gormStaticApi` field instead:
879
+
880
+
[source,groovy]
881
+
----
882
+
// Before (7.1.x and earlier)
883
+
class MyService extends GormService<MyDomain> {
884
+
void myMethod() {
885
+
def result = resource.list() // resource was GormAllOperations<T>
886
+
// ...
887
+
}
888
+
}
889
+
890
+
// After (7.1.x with fix)
891
+
class MyService extends GormService<MyDomain> {
892
+
void myMethod() {
893
+
def result = gormStaticApi.list() // use gormStaticApi instead
894
+
// ...
895
+
}
896
+
}
897
+
----
898
+
899
+
**Accessing the domain class**: If you need the Class reference, the `resource` field is now properly typed as `Class<T>`:
900
+
901
+
[source,groovy]
902
+
----
903
+
// Before
904
+
Class<MyDomain> clazz = resource.getClass() // awkward, resource was an instance
905
+
906
+
// After
907
+
Class<MyDomain> clazz = resource // resource is now the Class itself
908
+
----
909
+
910
+
===== 12.29 Enhanced Audit Metadata Support
865
911
866
912
Grails 7.1 introduces comprehensive audit metadata support with new annotations for tracking both temporal information (when changes occurred) and auditor information (who made changes). This aligns with Spring Data's auditing model while maintaining GORM's flexibility.
867
913
@@ -1116,4 +1162,4 @@ grails {
1116
1162
}
1117
1163
----
1118
1164
1119
-
This allows you to use classes from these packages without explicit imports throughout your Groovy code. The `starImports` configuration works independently and will be combined with any imports from `importGrailsCommonAnnotations` or `importJavaTime` flags if those are also enabled.
1165
+
This allows you to use classes from these packages without explicit imports throughout your Groovy code. The `starImports` configuration works independently and will be combined with any imports from `importGrailsCommonAnnotations` or `importJavaTime` flags if those are also enabled.
0 commit comments