RE: PK generation and different Apps [was: Back-button and statef ul components]
RE: PK generation and different Apps [was: Back-button and statef ul components]
- Subject: RE: PK generation and different Apps [was: Back-button and statef ul components]
- From: "Ruenagel, Frank" <email@hidden>
- Date: Fri, 5 Nov 2004 15:44:28 +0100
Hi,
The mssql Adaptor uses the EO_PK_TABLE when
he has to create an new pk.
The pk does not exists before saveChanges is
performed.
If you switch on EOF Debugging you can see what
EOF does on saveChanges, when a new record
has to be inserted.
So it could be a solution, that all Database-Apps
use this EO_PK_TABLE to synchronize their
PK-Generation. This is a mechanism very similar
to the sequence-mechanism in Oracle. EOF imitates
sequences with the EO_PK_TABLE.
MS-SQL itself does not use sequences, it uses
"identity" columns (like auto-numbering in MS Access).
It's not easy to plug such an table to EOF.
Because (different to an oracle-sequence-value)
the id-value does not exist before the row exists.....
:((
In this case you could think about:
1. A different, second column which is
the PK for EOF.
2. A stored procedure, which creates a new
empty record and gives back it's identity-column-pk.
In EOF then you could then create an EO with
EOUtilities.objectWithPrimaryKeyValue
In a special case (big, big table)
i implemented the latter successfully.
HTH
Frank
> -----Original Message-----
> From: Sako! [mailto:email@hidden]
> Sent: Friday, November 05, 2004 2:35 PM
> To: email@hidden
> Subject: Re: Back-button and stateful components
>
>
> Hello Pierre,
> i have MS sql,
> what do you mean with "Other applications you have would do
> best to rely on
> the same sequence."?
> how can i rely on the same sequence?
> the real problem is, i create the object in WO add it to the
> EC, at this
> time the Object has correct PK(hopfullely). before i call
> EC.SaveChanges().
> another Application has already inserted a row in the Table
> with the same
> PK. after that WO tries to insert row with invalid PK.
> this problem is also explaind in the WO documentation
> unfortunately without
> really good solution :(
>
>
> ----- Original Message -----
> From: email@hidden
> To: email@hidden
> Sent: Friday, November 05, 2004 10:06 AM
> Subject: RE: EOF inserts PK automatically
>
>
> Sako!
>
> The exact behavior depends on the database specific adaptor
> plug-in. The
> Oracle adaptor, as many others, gets its primary keys from a
> sequence. Thus
> no two WebObjects applications can get the same primary key. Other
> applications you have would do best to rely on the same sequence.
>
> Pierre
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden