RE: Back-button and stateful components
RE: Back-button and stateful components
- Subject: RE: Back-button and stateful components
- From: <email@hidden>
- Date: Fri, 5 Nov 2004 15:23:13 +0100
- Thread-topic: Back-button and stateful components
Sako!
> 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().
The PK is assigned only at saveChanges time. When you create an EO it is assigned an EOTemporaryGlobalID. At save time a new primary key is assigned and the temporary global is replaced by an EOKeyGlobalID which is based off the primary key.
> what do you mean with "Other applications you have would do best to rely on
> the same sequence."?
What I want to say is that the easiest way to make sure non WebObjects applications don't conflict with the WebObjects abased ones is to have them use the same logic for assigning primary keys.
Usually, you would have a sequence for each table (or root entity in the case of inheritence in your EOModel). Your table should never hold any row with a primary key larger than the sequence's current value. All insertions should rely on the sequence to provide a fresh primary key.
Pierre
-----Original Message-----
From: webobjects-dev-bounces+pierre.bernard=email@hidden
[mailto:webobjects-dev-bounces+pierre.bernard=email@hidden]On
Behalf Of Sako!
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:
This email sent to email@hidden
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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