prepareForDML method called twice
145423May 11 2007 — edited Jul 27 2007Have implemented a typical scenario (search - add - edit jspx pages).
Within one application module, one view object with dynamically created where criterion is used for searching, and another view object fetching at most one row is used for inserting/updating. The second view object is based on a join of an updatable entity (that has as primary key trigger-generated sequence number) and several referenced readable entities that bring descriptions of the codes of the updatable entity. Have implemented descriptions as output fields in the jspx, settign partialTriggers to the id of the code-field of the updatable entity having autoSubmit=true. Have concentrated business validation logic within the prepareForDML() of the updatable entity implementation.
Under normal conditions, it works fine.
Under heavy system load in production, or testing with ADF State Management enabled at work environment, I observe the prepareForDML() called twice instead of once.
Thus, the first time the insert is commited, the second time the validation rollback, and at last the whole transaction is rollbacked.
When I commented-out all the fields that bring descriptions and set all autoSubmit=false, prepareForDML() was called once.
However, my problem is that I have to bring the descriptions, that result from pop-up windows so that the end-user can see them after selecting sthg on his/er screen.
Why is prepareForDML() called twice, and how can I avoid this?