Cascade Save (Inheritance Parent\Chile)

Posts   
 
    
omid
User
Posts: 1
Joined: 03-Nov-2010
# Posted on: 03-Nov-2010 08:34:53   

Hi There I'm a newbe in llbl and recently working on a project with oracle and .net 3.5. In this project I have a Request (Parent : Abstract) table with Identity PK and a IssueRequest (Child) with foreign key with Request (1-1 : id-id). In my project I am writing this code:

            IssueCardRequestEntity issueCardReq = new IssueCardRequestEntity();
            issueCardReq.CardTypeCode = (int) CardType.Operator;
            issueCardReq.Description = "sdfsdfsd";
            issueCardReq.ReferenceNo = Guid.NewGuid().ToString();
            issueCardReq.RequestDate = DateTime.Now.ToString("dd/mm/yyyy");
            issueCardReq.CardId = 1;
            issueCardReq.CardReqStatusId = 1;
            issueCardReq.TerminalId = 1;

            try
            {                   
                Adapter.SaveEntity(issueCardReq);
            }

But when saving llblgen tries to save the child first and gives an error due to loss of foreign key of child. It means that it tries to save the child before parent and so an error occurs. Plase help me on this cause it's very ergant. Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Nov-2010 08:45:59   

I assume that IssueCardRequestEntity is the child IssueRequest, right? Did you specify the inheritance hierarchy in he designer?