At the recent Zagreb partner seminar I did on JDeveloper, ADF and JHeadstart, during the break someone presented a problem to me that they were having. Transforming their example into the equivalent Dept and Emp scenario, they were trying to allow the user -- while creating a new employee -- to go off and create a new department if they just realized that it was missing, and then come back and finish entering the employee in that new department. Trouble was, they would get database constraint violations for their EMP row because it was getting posted to the database before the DEPT row that got created later in time in the transaction.
Had their Dept and Emp been marked as a composition, it would have worked automatically, but since the relationship was optional between the two, it wasn't really correct to model it as a composition. So, I mentioned to him the same coding tip that I just published in this new HowTo on OTN:
Forcing a New Dept to Post Before a New Emp Without Composition
And that solved his problem. Hope it might come in handy for you, too, sometime...
10:32:29 PM
|