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
{code:title=Script2|borderStyle=solid}
// setup:
Person person = Person.list().last()
def id = person.id
def versionBeforeSave = person.version
// when: "set the property of concrete class and save"
person.mail = "[email protected]"
person.save(flush: true)
// then: "FAIL TO ASSERT"
Person savedPerson = Person.get(id)
assert savedPerson.version != versionBeforeSave
assert savedPerson.mail == "[email protected]"
{code}
The property 'mail' will not update and fail to assert because the object is not marked dirty.
If you modify properties of abstract class at the same time, it will be work fine.
Is it duplication of [GPMONGODB-334|http:https://jira.grails.org/browse/GPMONGODB-334]?
The text was updated successfully, but these errors were encountered:
Original Reporter: yuki-takei
Environment: Not Specified
Version: 1.3.3
Migrated From: http:https://jira.grails.org/browse/GPMONGODB-349
h6. Summary
Update is not working when these conditions are met:
h6. Confirming success when using Grails 2.2.4 and integration test
unzip test-with-2.2.4
cd test-with-2.2.4
grails test-app -integration
two Person documents will be created and both of 'version' will be 'NumberLong(1)'
h6. Confirming success when using Grails 2.2.4 and console (modify the property of abstract class)
unzip test-with-2.2.4
cd test-with-2.2.4
grails run-app
access http:https://localhost:8080/test-with-2.2.4/console
execute the code below
{code:title=Script1|borderStyle=solid}
// def setup()
def setupPerson = new Person()
setupPerson.name = "Philip"
setupPerson.mail = "[email protected]"
setupPerson.save(flush: true)
{code}
execute the code below anew
{code:title=Script2|borderStyle=solid}
// setup:
Person person = Person.list().last()
def id = person.id
def versionBeforeSave = person.version
// when: "set the property of abstract class and save"
person.name = "Allen"
person.save(flush: true)
// then: "update successfully"
Person savedPerson = Person.get(id)
assert savedPerson.version != versionBeforeSave
assert savedPerson.name == "Allen"
{code}
h6. Confirming success when using Grails 2.2.4 and console (modify the property of concrete class)
unzip test-with-2.2.4
cd test-with-2.2.4
grails run-app
access http:https://localhost:8080/test-with-2.2.4/console
execute the code below
{code:title=Script1|borderStyle=solid}
// def setup()
def setupPerson = new Person()
setupPerson.name = "Philip"
setupPerson.mail = "[email protected]"
setupPerson.save(flush: true)
{code}
execute the code below anew
{code:title=Script2|borderStyle=solid}
// setup:
Person person = Person.list().last()
def id = person.id
def versionBeforeSave = person.version
// when: "set the property of concrete class and save"
person.mail = "[email protected]"
person.save(flush: true)
// then: "update successfully"
Person savedPerson = Person.get(id)
assert savedPerson.version != versionBeforeSave
assert savedPerson.mail == "[email protected]"
{code}
h6. Confirming success when using Grails 2.3.5 and integration test
unzip test-with-2.3.5
cd test-with-2.3.5
grails test-app -integration
two Person documents will be created and both of 'version' will be 'NumberLong(1)'
h6. Confirming success when using Grails 2.3.5 and console (modify the property of abstract class)
unzip test-with-2.3.5
cd test-with-2.3.5
grails run-app
access http:https://localhost:8080/test-with-2.3.5/console
execute the code below
{code:title=Script1|borderStyle=solid}
// def setup()
def setupPerson = new Person()
setupPerson.name = "Philip"
setupPerson.mail = "[email protected]"
setupPerson.save(flush: true)
{code}
execute the code below anew
{code:title=Script2|borderStyle=solid}
// setup:
Person person = Person.list().last()
def id = person.id
def versionBeforeSave = person.version
// when: "set the property of abstract class and save"
person.name = "Allen"
person.save(flush: true)
// then: "update successfully"
Person savedPerson = Person.get(id)
assert savedPerson.version != versionBeforeSave
assert savedPerson.name == "Allen"
{code}
h6. NOT WORK when using Grails 2.3.5 and console (modify the property of concrete class)
unzip test-with-2.3.5
cd test-with-2.3.5
grails run-app
access http:https://localhost:8080/test-with-2.3.5/console
execute the code below
{code:title=Script1|borderStyle=solid}
// def setup()
def setupPerson = new Person()
setupPerson.name = "Philip"
setupPerson.mail = "[email protected]"
setupPerson.save(flush: true)
{code}
execute the code below anew
{code:title=Script2|borderStyle=solid}
// setup:
Person person = Person.list().last()
def id = person.id
def versionBeforeSave = person.version
// when: "set the property of concrete class and save"
person.mail = "[email protected]"
person.save(flush: true)
// then: "FAIL TO ASSERT"
Person savedPerson = Person.get(id)
assert savedPerson.version != versionBeforeSave
assert savedPerson.mail == "[email protected]"
{code}
The property 'mail' will not update and fail to assert because the object is not marked dirty.
If you modify properties of abstract class at the same time, it will be work fine.
Is it duplication of [GPMONGODB-334|http:https://jira.grails.org/browse/GPMONGODB-334]?
The text was updated successfully, but these errors were encountered: