Oracle Sequence not returning value

Posts   
 
    
RickT
User
Posts: 3
Joined: 26-Oct-2016
# Posted on: 26-Oct-2016 01:38:34   

We are accessing an Oracle 12c database and have an entity that is not returning a sequence value for the PK resulting in the following error.

ORA-01400: cannot insert NULL into ("VISION"."LS_GENERIC_VALUE"."ID_1") ORA-06512: at line 1

We have the sequence set in the designer for that (the only) PK (see attached).

We are using...

LLBLGenPro 4.2 Final .NET 4.0

Note: we have OracleDQECompatibilityLevel set to 1 in Web.config as suggested.

Please let me know any other information you might need.

Many Thanks, Rick

Attachments
Filename File size Added on Approval
image.png 29,992 26-Oct-2016 01:38.48 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Oct-2016 08:00:11   

Hi Rick,

Question: Is the entity field marked as identity? It looks like it doesn't so oracle isn't inserting the default value from the sequence. As you are using the OracleDQECompatibilityLevel=1, LLBLGen won't emit the sequence retrieval query before the insert.

So, try either changing the field to IsIdentity=false, or setting OracleDQECompatibilityLevel=0.

David Elizondo | LLBLGen Support Team
RickT
User
Posts: 3
Joined: 26-Oct-2016
# Posted on: 26-Oct-2016 18:28:04   

Hi David,

I don't see a place in LLBLGen to set "IsIdentity" for the field (see attached). Can you point out where to set that? I tried setting OracleDQECompatibilityLevel = 0, but still getting the same error.

Rick

Attachments
Filename File size Added on Approval
image1.png 34,378 26-Oct-2016 18:28.16 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 27-Oct-2016 09:25:57   

When using 12c compatibility level, the sequence is expected to be the default value of the field in the DB, as that's the way Oracle defines identity fields. When using the default compatibility level, the sequence is used to insert a value by first obtaining a value from the sequence and use that as insert value for the field.

Could you post some code which triggers this error? Other sequenced fields have the same error?

Frans Bouma | Lead developer LLBLGen Pro