Lets see..

Different adaptors use different techniques of getting the next integer for use
as a primary key.

Assuming you are using Oracle....  (ODBC uses another table EO_PK_SEQUENCE that
it creates if it is not there)

EOModeler will generate the following for Oracle in its 'Generate SQL' menu
option.
This was for a table called RepositoryDBRecord, with a primary key of
repositoryDBRecordId

Your problem might be that you are using a value class of "NSDecimalNumber"
instead of NSNumber.  See inspector and switch to integer instead of decimal
number.

Also, run your app with -EOAdaptorDebugEnabled YES as a command line arg.  Or
set it as a default using
"defaults write DOMAIN EOAdaptorDebugEnabled YES"  where DOMAIN is either the
name of your app or NSGlobalDomain to apply for all apps.

With this logging on, you should see the SQL it is using when looking for a new
primary key.

-dave

create table eo_temp_table as select max(repositoryDBRecordId) counter from
RepositoryDBRecord
/

create sequence RepositoryDBRecord_SEQ
/

create procedure eo_set_sequence is
    xxx number;
    yyy number;
begin
    select max(counter) into xxx from eo_temp_table;
    if xxx is not NULL then
        yyy := 0;
        while (yyy < xxx) loop
            select RepositoryDBRecord_SEQ.nextval into yyy from dual;
        end loop;
    end if;
end;

/

begin eo_set_sequence; end;
/

drop procedure eo_set_sequence
/

drop table eo_temp_table
/



"Schrecengost, James" wrote:

> On Monday, March 01, 1999 10:38 AM, David Scheck [SMTP:[EMAIL PROTECTED]]
> wrote:
> > A primary key will be generated for you IF you only have one attribute
> marked as
> > primary key AND it is an integer.
> >
> > -dave
>
> Okay, I think I get it now (after reading in my books and some past posts on
> the mail list)
> WebO will generate a unique key from a sequence, right?  I think that is the
> problem.. I have an int as my key,
> but it is a customer number, not a generated value from a sequence.. so it
> is looking for the sequence and not finding it,
> because I will give it...  hmm, okay.  How do I turn that option
> (auto-sequencing) off?  thanks!
>
> These opinions are mine, and not necessarily those of my employer.
>
> James 'Ghostman' Schrecengost
> Johns Manville, Electronic Commerce Team
> [EMAIL PROTECTED]
> 303-978-2677

Reply via email to