Problem with cascaded Master/Detail relationships

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?

Many thanks and best regards
Samuel

What platform (Delphi, .Net or XCode) you are using?

Hi slavad, I am using RemObjects with Delphi

Hello Samuel,

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.

Best regards

Hi

Please add in Schema Modeler the master detail relationship, using the “Relations” option

you can find more information here
http://wiki.remobjects.com/wiki/Relationships

this page has images for the previous Schema Modeler.

Hope it helps you

Best regards

I have added the master detail relationship on the schema, otherwise saving with an intermedia step wouldn’t work as well :wink:

Those are screenshots of both relationships and the error message

Hi
I don’t read german, but I undestand the word INSERT, and since you are using autoinc fields I’d recomend the following solution:

In your client application, in the field collection editor of the TDaMemDataTable
select your autoinc field(s) and uncheck the “logChanges” option.

best regards

Hello,

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.

Best regards