Hi All,

I believe I've worked out what my problem is, but not how to solve it.

The data structure for this part of the app involves 3 tiers of one:many relationships, ie the grandparent record has many parent records which have many child records. The actual entities are Route 1:n Delivery 1:n Trailerload, but I'll stick with grandparent, parent and child as I suspect these will be easier to follow.

To ensure this doesn't become a confusing array of forms, I've implemented the "grandparent" and "parent" forms as combined edit/list forms. So, the user interface involves starting with a list of grandparent records, selecting one to edit, leading to an Edit form with Grandparent details, as well as a list of Parent records. Clicking on a Parent row on the Grandparent edit form takes you to the parent edit form which enables the user to edit a parent record and its associated children.

My problem arises when using this last form. If I watch the database while navigating through the Grandparent edit form to the Parent edit form, I see that the version number for the selected Grandparent record increments once when going to the Grandparent edit form and then again AFTER going to the Parent edit form. Hence, when I submit the Parent edit form, it's rejected because it has the wrong version in its hidden field. If I use Firebug to increment the hidden version on the Parent edit form, it saves without a problem.

I suspect my problem arises from the fact that I have two Action classes, one for the grandparent records (renders the grandparent list and edits the grandparent) and another for the Parent and child records (renders the Parent+children edit form). This second Action also loads the Grandparent from the DB (as I believe it needs to) and from tracing through, this seems to be where the second increment to the version number comes from. I guess this makes sense as the app sees the Grandparent record as still being edited by the original Action and hence the second "hit" on the database causes the version to be incremented.

I believe that one solution to the problem would be to put everything into one action. I could also increment the grandparent version value on the parent form via an OGNL expression, but that feels way to kludgy to me. Would a single Action be the best solution, or is there a better way to do this?

Thanks,
Rob Hills
Waikiki, Western Australia

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to