The auto number thing is not so easy to change I think - it is a database driven number; not sure you want to go about and mess with those numbers. :)
Yes it takes quite a few flows alas, but then again you have full access control and validate what is written away via the server in specific contexts. This is probably the safest way :)
if you want to purge half-completed changes, just associate to $currentSession with a cascading delete. When the session is killed, the temp copy is also killed :)
if my solution worked, can you mark this as correct? Ty!
Hello Alparslan Arslan,
As already suggested by Wouter Penris, there are quite some options in which we can handle this use case. Below is one of the solution which we have implemented.
We have taken a enumeration in the Copy Entity with values as "New, Modified and Deleted".
1. When we create a new object of the entity "Copy", we set the enumeration to "New" and on hit of the save button on the Book_NewEdit page, we retrieve all the "Copy" with value as "New" and commit them and when user presses cancel, we retrieve all the "Copy" with value as "New" and delete them.
2. When we update any existing object of the entity "Copy", we set the enumeration to "Modified" and on hit of the save button on the Book_NewEdit page, we retrieve all the "Copy" with value as "Modified" and commit them and when user presses cancel, we retrieve all the "Copy" with value as "Modified" and rollback them to get the older values.
3. When we delete any existing object of the entity "Copy", we set the enumeration to "Deleted" and on hit of the save button on the Book_NewEdit page, we retrieve all the "Copy" with value as "Deleted" and delete them and when user presses cancel, we retrieve all the "Copy" with value as "Deleted" and rollback them to get the older values.
Hope this helps!
Regards
Praharaj