Skip to content

Commit 661249d

Browse files
committed
#1294 Revert changes related to comparing proxy in DirtyCheckable
1 parent 2f27f48 commit 661249d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,13 @@ trait DirtyCheckable {
9191
if( $changedProperties != null && !$changedProperties.containsKey(propertyName)) {
9292
boolean isNull = newValue == null
9393
if ((isNull && oldValue != null) ||
94-
(!isNull && oldValue == null) ||
95-
(!isNull && (newOldOrOldValueIsProxy(newValue, oldValue) && newValue.getAt("id") != oldValue.getAt("id")
96-
|| (!newOldOrOldValueIsProxy(newValue, oldValue) && !newValue.equals(oldValue))))) {
94+
(!isNull && oldValue == null) ||
95+
(!isNull && !newValue.equals(oldValue))) {
9796
$changedProperties.put propertyName, oldValue
9897
}
9998
}
10099
}
101100

102-
boolean newOldOrOldValueIsProxy(newValue, oldValue) {
103-
(newValue instanceof EntityProxy || oldValue instanceof EntityProxy)
104-
}
105-
106101
/**
107102
* @return A list of the dirty property names
108103
*/

grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/DirtyCheckingSpec.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ class DirtyCheckingSpec extends GormDatastoreSpec {
162162
@Entity
163163
class TestAuthor {
164164
String name
165+
166+
@Override
167+
boolean equals(o) {
168+
if (!(o instanceof TestAuthor)) return false
169+
if (this.is(o)) return true
170+
TestAuthor that = (TestAuthor) o
171+
if (id !=null && that.id !=null) return id == that.id
172+
return false
173+
}
165174
}
166175

167176
@Entity

0 commit comments

Comments
 (0)