ORACLE SEQUENCE management with entities

Posts   
 
    
davidz
User
Posts: 4
Joined: 12-Mar-2013
# Posted on: 02-Jul-2013 14:46:18   

Hi,

I work with oracle 11g and i want to know if it's possible to say to llblgen to attach a sequence value to an id column .

See my simple exemple , i create a simple table EV_CONFIGURATION with a primary key SETTING_ID :

create table EV_CONFIGURATION ( SETTING_ID NUMBER not null, SETTING_NAME VARCHAR2(100) not null, SETTING_VALUE VARCHAR2(100) not null, SETTING_DESC VARCHAR2(500) );

alter table EV_CONFIGURATION add constraint PK_EV_CONFIGURATION primary key (SETTING_ID) using index tablespace EVEREST_DAT pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K next 1M minextents 1 maxextents unlimited );

And i created a new sequence :

CREATE SEQUENCE SEQ_EV_CONFIGURATION START WITH 1 MAXVALUE 99999999 MINVALUE 0 NOCYCLE CACHE 20 NOORDER;

Is it possible to parametrize llblgen in order to use the genenrated Evconfiguration entity , assigning automatically to SETTING_ID field the SEQ_EV_CONFIGURATION.NEXT during Save() method call.

Example :

Imagine that SEQ_EV_CONFIGURATION.CURRVAL = 5 , i want to write in my csharp code :

EvConfigurationEntity e = new EvConfigurationEntity(); e.settingname= "toto"; e.settingvalue= "tata"; e.settingdesc = "desc"; e.Save();

-> i wish that it will do : insert into EV_CONFIGURATION(SETTING_ID , SETTING_NAME , SETTING_VALUE , SETTING_DESC ) values( '6','toto','tata','desc');

confused

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 02-Jul-2013 15:32:10   

Yes, just specify the sequence in the mapping of SettingsID and the engine will obtain the new sequence value and use it for new rows automatically, you don't have to anything else.

Frans Bouma | Lead developer LLBLGen Pro
reube123
User
Posts: 1
Joined: 04-Jul-2013
# Posted on: 04-Jul-2013 08:43:43   

I work with oracle 11g and i want to know if it's possible to say to llblgen to attach a sequence value to an id column .

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 04-Jul-2013 10:50:29   

reube123 wrote:

I work with oracle 11g and i want to know if it's possible to say to llblgen to attach a sequence value to an id column .

Yes, open the entity in its editor in the designer and go to field mappings, then click the sequence combo for the field and you should see the sequences available. Pick the right one and save and regenerate your code.

Frans Bouma | Lead developer LLBLGen Pro