Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 2.0-RC1
-
Fix Version/s: 2.0-RC2
-
Component/s: Persistence
-
Labels:None
-
Environment:Windows7
Description
In the attached bug-report project, a hasMany relationship backed by a List of Book in Author:
1. Adding a Book and then editing that book modifies the books_idx column as if it were adding a new Book, i.e. if there is only 1 Book in books it bumps the books_idx from 0 to 1 causing an exception to be thrown when attempting to show the Author.
2. After adding multiple Books, if any Book but the last one is deleted, a gap is left in the books_idx causing an exception to be thrown when attempting to show the Author. I work around this in the BookController, see the try block in the delete method, by first deleting the Book from the Author's books collection before saving. I don't know if there's a way to detect this situation and do it automatically.
3. The documentation concerning "Lists of Objects" in Section 5.2.4 should probably be updated to more accurately reflect the true current state of affairs. It currently says the code, presumably in the BookController should first addToBooks but it does not need to be done, unlike the corresponding delete.
This appears related to fixes made in GRAILS-3783.
-
Hide
- books-bug-report-10112011.zip
- 10/Nov/11 2:20 PM
- 49 kB
- Ken Krebs
-
- grails-app/.../ApplicationResources.groovy 0.1 kB
- grails-app/conf/BootStrap.groovy 0.1 kB
- grails-app/conf/BuildConfig.groovy 2 kB
- grails-app/conf/Config.groovy 4 kB
- grails-app/conf/DataSource.groovy 1 kB
- grails-app/conf/UrlMappings.groovy 0.2 kB
- grails-app/conf/spring/resources.groovy 0.0 kB
- grails-app/.../AuthorController.groovy 4 kB
- grails-app/.../BookController.groovy 4 kB
- grails-app/domain/books/Author.groovy 0.2 kB
- grails-app/domain/books/Book.groovy 0.2 kB
- grails-app/i18n/messages.properties 3 kB
- grails-app/.../messages_cs_CZ.properties 3 kB
- grails-app/i18n/messages_da.properties 3 kB
- grails-app/i18n/messages_de.properties 4 kB
- grails-app/i18n/messages_es.properties 3 kB
- grails-app/i18n/messages_fr.properties 2 kB
- grails-app/i18n/messages_it.properties 2 kB
- grails-app/i18n/messages_ja.properties 4 kB
- grails-app/i18n/messages_nl.properties 3 kB
- grails-app/.../messages_pt_BR.properties 3 kB
- grails-app/.../messages_pt_PT.properties 3 kB
- grails-app/i18n/messages_ru.properties 4 kB
- grails-app/i18n/messages_sv.properties 3 kB
- grails-app/i18n/messages_th.properties 6 kB
- grails-app/.../messages_zh_CN.properties 2 kB
- grails-app/views/author/_form.gsp 0.9 kB
- grails-app/views/author/create.gsp 2 kB
- grails-app/views/author/edit.gsp 2 kB
- grails-app/views/author/list.gsp 2 kB
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Jeff - could you have a look at this one?