I'd like to stop some rows being committed at Entity Object Level based on existence of child rows.
So say I have a parent EO and two child EOs, - if I'm missing a child, how do make sure none of the parent/child rows are posted/committed?
I tried putting logic in postChanges() and prepareForDML() where I would either do a remove() or setNewRowState (STATUS_INITIALIZED).
It does not seem to like it.
not sure I understand the use case. Do you want to tell if a parent entity has at least two child EO and if it doesn't don't commit, or what does "if I'm missing a child" mean?
If my assumption is correct then a variation of the following code snippet should do it
Yes thats sort of what I mean.
The problem here is that I can use variations of the code you've linked to change attributes of the parent and child EO and even the ordering of the post but there does not seem to be a method to say -
"Please do not commit this row or any of its children."
I'd like to 'mark' these rows as "Do not post".
what happens if you don't call
if the requirement of 2 detail entities is not met?
Another hook appears to be doDML()
as it allows you to suppress the update statement (and thus the commit consequences)
Edited by: Frank Nimphius on Jan 21, 2013 11:01 AM
Thanks - that worked.
I had to put that code in the parent EO and the child EOs (in doDML).
I am concerned about the state of the row after the commit cycle.
Is the row considered posted/committed data or not? And will ADF be able to deal with the inconsistency?
Edited by: zebonsoft on Jan 21, 2013 7:01 AM