Inheritance: PK NULL-Exception when saving entity

Posts   
 
    
Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 12-Sep-2006 11:23:05   

I hate it, but I have to write again. confused

Inheritance scenario: Frage inherits from Text.

If I want to save a Frage entity, i get this: "An exception was caught during the execution of an action query: Der Wert NULL kann in die lngPK_Frage-Spalte, Bedingung.dbo.tbl_Frage-Tabelle, nicht eingefügt werden. Die Spalte lässt NULL-Werte nicht zu. Fehler bei INSERT. Die Anweisung wurde beendet.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."

I checked the following: * lngPK_Frage is an Id in the DB, and also in the designer * lngPK_Text is an Id in the DB and also in the designer * There is an 1:1 relationship modelled in the DB * The inheritance can be modelled by right-clicking the entities - so everything should be ok. * lngPK_Text is an identity in the DB, meaning it sets its own value (integer value) when inserting a new row. * lngPK_Frage is no identity.I compared it with my other modelled inheritances. When I use them, the PK of the sub class is always set automatically by the LLBLGen generated code before saving. Why not in this case? What did I miss?

Thanks in advance! simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 12-Sep-2006 12:21:19   

Could you please translate the exception to english? Not all of us speak German wink . Which field gets NULL inserted exactly?

Frans Bouma | Lead developer LLBLGen Pro
Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 12-Sep-2006 12:51:55   

smile Ooops sorry. Of course! I found the english version of the exception message in another post:

An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'lngPK_Frage', table 'tbl_frage'; column does not allow nulls. INSERT fails.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 12-Sep-2006 19:57:40   

Hi,

this sounds like a very particular issue. I could ask for many more details such as version, driver, code etc...

But I guess the easies way would be that your send an email to support at llblgen dot com with your script, llblgen project, and own code so that we can reproduce the error.

Cheers

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 13-Sep-2006 11:04:01   

The PK field of frage, the subtype, was set as identity field in the designer (while the table field isn't an identity field). This thus makes the DQE not send a value to the DB for the insert query, but instead assumes it's an identity field. -> Error.

Frans Bouma | Lead developer LLBLGen Pro