Forte Express - Transaction control
Hi
In our current model, the database automatically generates a key
for our objects when we insert them into the database (we are
using the Informix Serial type to do this - but it could be any
similar mechanism).
The problem we encounter is that within Forte Express, we want
to be able to create several related objects simultaneously and
then commit the whole thing in one transaction. However, the
objects reference eachother by their key and until the Insert
has been committed to the database, we don't know what the key is.
Has anyone encountered a similar problem?
Thank you,
Veronika Irvine
CrossKeys Systems Corporation
virvine@crosskeys.com
[758 byte] By [
] at [2007-11-25 4:59:39]

Yes, and for this reason we have decided against using Informix or Sybase
serial types. Oracle Sequences
are ok since you can prefetch them and, hence, "know" what they are before
and after your transaction.
For keys which are used in object traversals, we implement a table-based key
generation system.We have
a table with two columns, table-name and next-key. Each kind of key has a
row in this table, and we access the table in the following way: (I think it
is a pretty standard approach)
begin transaction
update keytable set nextkey = nextkey + 1 where tablename = :sometablename
select nextkey from keytable where tablename = :sometablename
end transaction
This ensures protection in a concurrent environment, and is a small enough
transaction to handle lots of
requests. Note the downside to this approach is that if the key isn't used
you will end up with "holes" in the key sequences.
Another technique you can try is to have a temporary key between the
objects. A timestamp to millisecond
resolution might serve you in this case.
-John
At 02:20 PM 8/2/96 -0400, you wrote:
>Hi
>
>In our current model, the database automatically generates a key
>for our objects when we insert them into the database (we are
>using the Informix Serial type to do this - but it could be any
>similar mechanism).
>
>The problem we encounter is that within Forte Express, we want
>to be able to create several related objects simultaneously and
>then commit the whole thing in one transaction. However, the
>objects reference eachother by their key and until the Insert
>has been committed to the database, we don't know what the key is.
>
>Has anyone encountered a similar problem?
>
>
>Thank you,
>
>Veronika Irvine
>CrossKeys Systems Corporation
>virvine@crosskeys.com
>
**************************************
John Jamison
Sage Solutions, Inc.
353 Sacramento Street, Suite 1360
San Francisco, CA 94111
415 392 7243 x 508
john.jamison@sagesoln.com
at 2007-6-29 9:16:51 >
