Skip to content

Commit edb5eb7

Browse files
authored
Merge pull request #1490 from grails/updateDirtyCheckingSupport
Update DirtyCheckingSupport
2 parents 213ea64 + f7ae81a commit edb5eb7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/dirty/checking/DirtyCheckable.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ trait DirtyCheckable {
8686
*/
8787
void markDirty(String propertyName) {
8888
if( $changedProperties != null && !$changedProperties.containsKey(propertyName)) {
89+
if (DirtyCheckingSupport.DIRTY_CLASS_MARKER.is($changedProperties)) {
90+
trackChanges()
91+
}
8992
$changedProperties.put propertyName, ((GroovyObject)this).getProperty(propertyName)
9093
}
9194
}
@@ -113,6 +116,9 @@ trait DirtyCheckable {
113116
if ((isNull && oldValue != null) ||
114117
(!isNull && oldValue == null) ||
115118
(!isNull && !newValue.equals(oldValue))) {
119+
if (DirtyCheckingSupport.DIRTY_CLASS_MARKER.is($changedProperties)) {
120+
trackChanges()
121+
}
116122
$changedProperties.put propertyName, oldValue
117123
}
118124
}

grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/dirty/checking/DirtyCheckingSupport.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DirtyCheckingSupport {
3737
/**
3838
* Used internally as a marker. Do not use in user code
3939
*/
40-
public static final Map DIRTY_CLASS_MARKER = [:]
40+
public static final Map DIRTY_CLASS_MARKER = [:].asImmutable()
4141
/**
4242
* Checks whether associations are dirty
4343
*

0 commit comments

Comments
 (0)