xpusostomos opened a new issue, #14418:
URL: https://github.com/apache/grails-core/issues/14418

   I would like to resurrect a previously reported bug...
   
   https://github.com/grails/grails-core/issues/11321
   
   Because I for one can't see how there is not some kind of bug here.
   
   According to the documentation 
http://gorm.grails.org/6.0.x/hibernate/manual/#modificationChecking
   
   "isDirty() does not currently check collection associations, but it does 
check all other persistent properties and associations."
   
   But the documentation doesn't tell you how to make these associations save, 
since apparently it can't detect changes automatically.
   
   ```
   Person person = Person.findByName('alber2')
   Position position = Position.findByName('boss2')
   person.addToPositions(position)
   ```
   
   This does not save the new relationship.
   
   In the 1:M case, lack of auto dirty checking doesn't seem such a problem 
because one of the visible tables will have changed and will be dirty. But in 
the M:M case, the table that needs to change is the invisible table 
position_person that's automatically populated. 
   
   One can't call markDirty() on the intervening position_person table, because 
it's invisible to the programmer in the infrastructure.
   
   I've tried marking the owning table and subordinate tables as dirty:
   
   Person person = Person.findByName('alber2')
   Position position = Position.findByName('boss2)
   person.addToPositions(position)
   position.markDirty()
   person.markDirty()
   But that doesn't work. person.isDirty() still returns false, and the 
relationship doesn't save.
   
   How is this supposed to work? How can I get the relationship to save?
   
   - **GORM Version:** 6.1.12
   - **Grails Version (if using Grails):** 3.3.14
   - **JDK Version:** 1.8
   
   ### Example Application
   
   There is an example app here 
https://github.com/grails/grails-core/issues/11321
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to