Oracle Identitys and Triggers

Posts   
 
    
Geddy
User
Posts: 1
Joined: 24-Jan-2008
# Posted on: 24-Jan-2008 17:40:11   

I am new to LLBLGen Pro but absolutely love what I have seen so far. Congratulations on producing such a fine product.

I have a database table in Oracle named EmailAddress for which I have created a EmailAddressEntity using LLBLGen Pro. The primary key of the table is named EmailID. EmailID receives an auto-incremented value each time a record is inserted via a trigger that makes use of a sequence.

When I do the following:

EmailAdressEntity objEmailAddress = new EmailAddressEntity();
objEmailAddress.SecId = "some value";
objEmailAddress.Email = "test@example.org";
objEmailAddress.Type = "USER";
objEmailAddress.TransDt = DateTime.Now;
objEmailAddress.OprId = oprId;
objEmailAddress.Save();

The record is successfully created in the database; however, objEmailAddress.EmailID returns a value of zero (instead of the actual EmailID that was inserted via the trigger).

I seached the forums and found several threads regarding this issue. I have added <add key="OracleTriggerSequences" value="true" /> to my config file.

I also read that it may be necessary to check the "Is Identity" option for the EmailID field within the designer and select the proper sequence. However, when I go the properties of the EmailID field within the designer the "Is Identity" checkbox is disabled (grayed out) and I am unable to click it.

The DDL for the EmailAddress table is:

EMAIL_ID NUMBER(10, 0) NOT NULL,
  SEC_ID VARCHAR2(12 BYTE) NOT NULL,
  EMAIL_TXT VARCHAR2(64 BYTE),
  TYPE_TXT VARCHAR2(32 BYTE),
  TRANS_DT DATE,
  OPR_ID VARCHAR2(4 BYTE)
, CONSTRAINT EMAIL_ADDR_PK PRIMARY KEY
  (
    EMAIL_ID
  )

Using a trigger for the ID field is required by the standards of my company, so unfortainately I am unable to remove it.

Other Info: Version/Build: LLBLGen Pro 2.5 (Dec. 5, 2007) Using Selfservice with .Net 2.0 Database: Oracle 9i (9.2.0.8.0) with the MS Oracle driver

Please let me know if any other information is needed.

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-Jan-2008 10:50:28   

Would you try to read the schema using ODP.NET 9i and see if you can set the IsIdentity flag in the Designer?

(EDIT) I guess that's a somehow related thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10250