How to post a detail record in an FDQuery with the parent record in insert mode?

0

I'm using two FDQuery with master-detail relationship and found a problem: using the CachedUpdates property and relating both FDQuery to a FDSchemaAdapter . If you call " Insert / Append " in Mestre and then (with Mestre dsinsert ) is called an "Insert" and then a "Post" in detail record, the the following error occurs:

  

[FireDAC] [DatS] -16. Can not process - no parent row. Constraint   [ForeignKeyConstraint].

I know this is because in the "Post" order, the child record is being inserted without a parent record being posted yet, but in the database the foreign key is "Deferred".

So, how do I FireDac ignore this restriction without disabling the DetailCascade property and keeping the cascading "delete / update" functionality cached?

I've tried to use FDSchemaAdapter.DatSManager.EnforceConstraints , but the result is similar to disabling the DetailCascade property of FDquery .

Note: I'm using Delphi XE5.

    
asked by anonymous 28.11.2017 / 21:27

1 answer

0

Unfortunately, in Delphi XE5, using the DetailCascade feature is not possible through the component's native properties. Only from the Berlin version or higher by unchecking the DetailServerCascade property. The unpleasant alternative in a multilevel scenario is to not use DetailCascade and do the operations manually.

    
06.12.2017 / 02:11