writing SDO based on temp-table to the DB

Posted by Admin on 03-Feb-2009 05:06

OpenEdge Release 10.1C

Dynamics

John Sadd's "Building SmartDataObjects against Temp-tables" learned me how to define a temp-table and use it as a data source for an SDO. This gives you the freedom of selecting only those DB fields and records you want using manual coding.

In design time writing the same tt-records back to the DB works fine, but when running on AppServer the following error occurs:

"This database record does not exist or is locked by another user. Update cancelled".

I guess the tt on server-side is emptied as soon as passing it to client-side, thus records you want to write back to de DB no longer exist.

What is the best way to achieve this (if there is any)?

Greetings,

Rob

All Replies

Posted by Admin on 03-Feb-2009 14:02

Well the main issue is the fact, that the SDO uses rowids to fetch the updated rows for updating. Temp-Table ROWIDs do change - so even when you rebuilt the temp-table in initializeObject or queryOpen or similar the ROWIDs are different and can't be found (refetchDBRow) for the update.

First of all, a temp-table SDO should always be running on the client (no AppServer partition defined, not using Astra). Then you should write your own service routines for the update and trigger those from assignDBRow or a postTransValidated routine or similar.

It requires a lot of manual coding.

and use it as a data source for an SDO. This gives

you the freedom of selecting only those DB fields and

records you want using manual coding.

You can select fields in an SDO against a DB query as well. Records might be more difficult, using a complex query might be surprisingly more efficient sometimes. For complex szenarios, the DataView and the use of ProDatasets/Business Entities might be a more up to date solution.

HTH,

Mike

Posted by Admin on 26-Jun-2009 08:38

I have an internal document that deals with this subject as we use temp-table based SDOs in a couple of places. Its a little rough, but it may be helpful to you. Also, if you've done any further work on tt SDOs, I'd like to hear about it.

-Tom

Posted by Admin on 26-Jun-2009 08:41

tomg schrieb:

Also, if you've done any further work on tt SDOs, I'd like to hear about it.

-Tom

I'm trying to avoid them wherever I can nowadays! The ADM2 DataView SmartObject talking to an OERA business entity gives you soooo much more flexibility.

This thread is closed