If an already persisted entity has a one-to-many relationship defined with a cascade of either delete-orphan or all-delete-orphan, updating it throws an error.
For example, saving a loaded parent entity with a property definition such as
..results in an error:
"A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: Parent.children".
Full stack trace:
Running the same code under Lucee 4.5 works fine.
Test case attached.
Windows 10, Java 1.8 (u121), Tomcat 8.5.11
Hibernate extension: 184.108.40.206
I can duplicate this on 220.127.116.11 and completely breaks ContentBox CMS. You can see our tests here that fail: https://github.com/coldbox-modules/cbox-cborm/blob/development/tests/specs/BaseORMServiceTest.cfc and our models: https://github.com/coldbox-modules/cbox-cborm/tree/development/models/entities
also see this on command line
problem caused by
I upgraded to 18.104.22.168-SNAPSHOT from stable release 22.214.171.124 and found ORM acting weird, the relationship in the link table was somehow REMOVED. And I observed the following SQL statement in CommandBox console:
In my scenario, a user can have many companies and a company can have many users, so in my User.cfc bean:
Once I downgraded back to 126.96.36.199, the scary DELETE sql disappears.
I suspect that it has something to do with this ticket.
I've just started using ORM, so maybe there are flaws in my many-to-many relationship part, I can't tell for sure for the moment. Anyway, just little heads-up here.