Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Duplicate
-
Affects Version/s: 1.0.3
-
Fix Version/s: 1.1
-
Component/s: None
-
Labels:None
Description
An explanation of the current behaviour and why it's not exactly ideal is given here:
http://www.cacoethes.co.uk/blog/index.php?p=38
One possible solution is to use the Hibernate's Session.setReadOnly() method to ensure that changes to a domain instance are not persisted at flush time if there are any binding or validation errors.
Hopefully it would also be possible to call Session.setReadOnly(false) to make the changes persist if, for example, the save() succeeds after any binding errors have been manually rectified. It might be worth making the method available on domain instances directly too.
Attachments
-
$i18n.getText("admin.common.words.hide")
- grails-3163.zip
- 11/Mar/09 7:52 PM
- 165 kB
- John Allison
-
- grails-3163/web-app/css/main.css 5 kB
- grails-3163/web-app/.../tld/spring.tld 7 kB
- grails-3163/web-app/WEB-INF/tld/fmt.tld 19 kB
- grails-3163/web-app/.../tld/grails.tld 32 kB
- grails-3163/web-app/WEB-INF/tld/c.tld 16 kB
- grails-3163/web-app/WEB-INF/sitemesh.xml 0.6 kB
- grails-3163/.../applicationContext.xml 2 kB
- grails-3163/web-app/js/application.js 0.4 kB
- grails-3163/web-app/.../dragdrop.js 31 kB
- grails-3163/web-app/.../unittest.js 20 kB
- grails-3163/web-app/.../animation.js 10 kB
- grails-3163/web-app/.../scriptaculous.js 3 kB
- grails-3163/web-app/js/prototype/rico.js 82 kB
- grails-3163/web-app/.../controls.js 34 kB
- grails-3163/web-app/.../prototype/sound.js 2 kB
- grails-3163/web-app/.../prototype/effects.js 38 kB
- grails-3163/web-app/.../prototype/slider.js 10 kB
- grails-3163/web-app/.../prototype.js 121 kB
- grails-3163/web-app/.../prototype/builder.js 5 kB
- grails-3163/web-app/.../grails_logo.jpg 8 kB
- grails-3163/web-app/images/favicon.ico 4 kB
- grails-3163/web-app/images/spinner.gif 2 kB
- grails-3163/web-app/.../database_save.png 0.7 kB
- grails-3163/web-app/.../skin/information.png 0.8 kB
- grails-3163/web-app/.../skin/sorted_asc.gif 0.8 kB
- grails-3163/web-app/.../skin/exclamation.png 0.7 kB
- grails-3163/web-app/.../skin/house.png 0.8 kB
- grails-3163/web-app/.../database_table.png 0.7 kB
- grails-3163/web-app/.../database_delete.png 0.6 kB
- grails-3163/web-app/.../skin/shadow.jpg 0.3 kB
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
The original blog post from bug GRAILS-3163 is long gone.
Here is a grails-user thread related to that blog post:
http://www.nabble.com/The-dangers-of-"obj.properties-%3D-params"-td18065376.html#a18065376
According to that thread, GRAILS-2528 may be related.
Here is another blog post with some other details:
http://stateyourbizness.blogspot.com/2008/05/fun-with-hibernates-flush-mode.html
This has already been fixed, we set an object to read only if a binding error occurs
I've tried to make this simple. Attached is a zip of a grails project with a test illustrating the bug. Calling Domain.hasErrors() causes the database to be updated even if one of the properties has a validation error. This behavior seems rather wrong and still exists in 1.1