This is a migrated thread and some comments may be shown as answers.

Key generator

2 Answers 125 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Henk
Top achievements
Rank 1
Henk asked on 02 Nov 2009, 01:45 PM
Hello,

In our Oracle database the ID field of each table is filled by a unique Oracle sequence for each table.
Before insert of a new record our client/server application asks for a new ID (select tablename_seq.nextval from dual)
The value received from the sequence is used during insert of the record.

Is it possible that OA uses the same mechanism to fill the ID when a new object is created? How can I implement this in my OA model?

2 Answers, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 04 Nov 2009, 01:11 PM
Hello Henk Boen,

 In order to set up things to work with OpenAccess you can create a trigger on insert of a row and set the value of the ID column using the Oracle sequence. You should specify the 'AUTOINC' key generator for the class,using the Forward mapping wizard.

During runtime, OpenAccess will use the sequence generated ID value to maintain object identity.

Hope this answers your question.

Greetings,
Ady
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marshmalow
Top achievements
Rank 1
answered on 20 Dec 2010, 02:11 PM
Hello,
I have the same problem like in the first post:
In our Oracle database the ID field of each table is filled by a unique Oracle sequence for each table.
Before insert of a new record our client/server application asks for a new ID (select tablename_seq.nextval from dual)
The value received from the sequence is used during insert of the record.

I cannot use database trigger. I don't know why but my application architect has forbidden me to use trigger in database.
My question is:
Is it possible use some different technique for inserting value from sequence to inserting row without trigger ?
- maybe modify final SQL insert statement, where I would replace inserting value for SEQ_PK.nextval function
- or is it possible define default value for primary key column where it will SEQ_PK.nextval function like column value ??

Thanks
Tomas


 
Tags
Development (API, general questions)
Asked by
Henk
Top achievements
Rank 1
Answers by
Ady
Telerik team
Marshmalow
Top achievements
Rank 1
Share this question
or