Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 2.0.4
-
Component/s: Persistence
-
Labels:None
-
Testcase included:yes
Description
Apologies that this is quite complex. If you have:
- A tree-like self-referential relationship, e.g. X hasMany X
- A hasMany List relationship on X to some other entity type, e.g. X hasMany Y
- Y belongsTo X
- X uses a uuid generator for its id
Saving the top level X with a graph of objects underneath it will fail with
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: Y
If the X hasMany Y is a Set this does not happen. It does happen if X has a single Y when Y does not have a belongsTo declared.
This is a regression from 2.0.3 where this worked fine.
Please see the attached example project with failing test.
-
Hide
- self-referencing-bug-report-24052012.zip
- 24/May/12 6:36 AM
- 22 kB
- Robert Fletcher
-
- grails-app/.../ApplicationResources.groovy 0.1 kB
- grails-app/conf/BootStrap.groovy 0.1 kB
- grails-app/conf/BuildConfig.groovy 1 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/domain/test/Parrot.groovy 0.2 kB
- grails-app/domain/test/Pirate.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/error.gsp 0.3 kB
- grails-app/views/index.gsp 3 kB
- grails-app/views/layouts/main.gsp 2 kB
- test/integration/test/PirateTests.groovy 0.3 kB
- application.properties 0.1 kB
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
I believe the fixes for
GRAILS-9170fixed this issue