Delete behaviour and not committed objects

4
I currently have the following situation: I have objects Application and Contact. Contact has a reference to Application. (Since one Application can have multiple contacts) When an Application is created, a form will open in which the details can be filled in, as well as Contacts added to the Application. Now as a result I have the issue that Contact objects when created can get committed to the database before the Application gets committed for the first time (Since you can add Contacts in the form which opens up on creation of an Application). If the user then closes the Application_NewEdit form or presses the cancel button, the Application never gets committed to the database, while the Contacts already were committed to it. Now I don't see too many issues coming up with workaround for this if necessary, but I'm wondering if delete behaviour affects this. I've set things up so that if an Application is deleted, so are its Contacts. (Those are App specific objects, so pointless to keep them) However I was wondering if this will also cause the Contacts to be deleted if creation of the Application is cancelled, or if I need to change my model a bit to account for this?
asked
2 answers
3

I am not sure if it is delete behaviour we are looking at. It might also be a rollback, because the object was never stored so it does not require a delete. However, even if it is deleted i doubt that delete behaviour will delete the contacts. Because the association to the application is not stored yet.

answered
1

Just did some tests myself to verify how this works.

When a not-yet committed Object is rolled back (ie, cancel button), delete behavior will indeed cascade when set up this way. When created in the Application_NewEdit form, the Contact objects were committed to the database, but deleted after I rolled back the Application object they referenced to.

answered