Hi Guys
I have a problem using three tables (Module,Templates,Resources) and two Master/Detail relationships (Module <- Templates, Templates <- Resources). All tables have autoInc values as primary key.
If I create a Module with multiple Templates - save - add resources to one or more templates - save => everything works fine. However, if i create a Module with multiple Templates with multiple Resources - save => I get an foreign key constraint violation on the database saying that the ForeignKey in Resources (referencing a template) is wrong.
Is, what I intend to do, not possible or what could probably cause this issue?
What DA version, DB and driver do you use? What MasterMappingMode for creating Master/Detail relationships on the client do you use?
You could also do some testing with our Multi Level details sample that is situated in \RemObjects samples\DataAbstract for Delphi\Multi Level Details folder. I have checked it for MSSQL and FB databases, there are no any problems with your scenario.
In your client application, in the field collection editor of the TDaMemDataTable
select your autoinc field(s) and uncheck the “logChanges” option.
If LogChanges will be unchecked, then AutoInc field won’t be included in delta sent to the server. Therefore server won’t be able to return newly generated value for AutoInc field. So this is not right, LogChanges should be checked for AutoIncs. You could examine our Multi Level Details and Server samples and see how it is organized there. Read also article regarding AutoIncs mechanism in DA Documentation | RemObjects Software
Please answer my previous questions. You could also attach your sample project demonstrating error and DDL for tables, cause it could be some inaccurancy in project schema or somewhere else.