Legacy DB and Associations

I have a legacy DB with this Entity mapping:

  [Entity]
  [Table('TBLREZEPT')]
  [Id('FREZEPTID', TIdGenerator.None)]
  TTBLREZEPT = class
  private
    [Column('REZEPTID', [TColumnProp.Required, TColumnProp.NoUpdate])]
    FREZEPTID: Integer;
   
    [ManyValuedAssociation([TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAll , 'FREZEPTID')]
    FTBLREZEPTZUTATList: Proxy<TList<TTBLREZEPTZUTAT>>;
    function GetTBLREZEPTZUTATList: TList<TTBLREZEPTZUTAT>;
  public
    property TBLREZEPTZUTATList: TList<TTBLREZEPTZUTAT> read GetTBLREZEPTZUTATList;
  end;
 
  [Entity]
  [Table('TBLREZEPTZUTAT')]
  [Id('FREZEPTID', TIdGenerator.None)]
  [Id('FLFDNR', TIdGenerator.None)]
  [Id('FREZEPTPOSID', TIdGenerator.None)]
  TTBLREZEPTZUTAT = class
  private
    [Column('LFDNR', [TColumnProp.Required])]
    FLFDNR: Integer;
   
    [Column('REZEPTPOSID', [TColumnProp.Required, TColumnProp.NoUpdate])]
    FREZEPTPOSID: Integer;
    [Association([TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAll - [TCascadeType.Remove])]
    [JoinColumn('REZEPTID', [TColumnProp.Required], 'REZEPTID')]
    FREZEPTID: Proxy<TTBLREZEPT>;
...    


Trying this code

procedure TForm1.TestProcedure1;
var
  Rezept: TTBLREZEPT;
  zutat: TTBLREZEPTZUTAT;
begin
  Rezept := TTBLREZEPT.Create();
  Rezept.REZEPTID:=3;
  Rezept.BEZEICHNUNG:='Test 01';
  Rezept.SERIAL:=1;
  zutat := TTBLREZEPTZUTAT.Create();
  zutat.REZEPTID:=Rezept;
  zutat.LFDNR:=1;
  zutat.REZEPTPOSID:=2;
  Rezept.TBLREZEPTZUTATList.Add(zutat);
  mgr.Save(Rezept);
end;

generates this SQL:

[15.03.2020 13:01:07][Trace][Value: INSERT INTO TBLREZEPT (
  REZEPTID, SERIAL, BEZEICHNUNG)
 VALUES (
  :A_REZEPTID, :A_SERIAL, :A_BEZEICHNUNG)][Type: string]
[15.03.2020 13:01:07][Trace][Value: A_REZEPTID = "3" (ftInteger)][Type: string]
[15.03.2020 13:01:07][Trace][Value: A_SERIAL = "1" (ftInteger)][Type: string]
[15.03.2020 13:01:07][Trace][Value: A_BEZEICHNUNG = "Test 01" (ftString)][Type: string]
[15.03.2020 13:01:07][Trace][Value: UPDATE TBLREZEPTZUTAT SET
  REZEPTID = :A_REZEPTID
WHERE REZEPTID = :p_1
  AND HERKUNFTCD = :p_2
  AND LEBENSMITTELCD = :p_3
  AND LFDNR = :p_4
  AND REZEPTPOSID = :p_5][Type: string]
[15.03.2020 13:01:07][Trace][Value: A_REZEPTID = "3" (ftInteger)][Type: string]
[15.03.2020 13:01:07][Trace][Value: p_1 = "3" (ftInteger)][Type: string]
[15.03.2020 13:01:07][Trace][Value: p_2 = "BLS3.02" (ftString)][Type: string]
[15.03.2020 13:01:07][Trace][Value: p_3 = "B100000" (ftString)][Type: string]
[15.03.2020 13:01:07][Trace][Value: p_4 = "1" (ftInteger)][Type: string]
[15.03.2020 13:01:07][Trace][Value: p_5 = "2" (ftInteger)][Type: string]


Which obviously is wong. How can I make the child records to be inserted?

tx for support!
I reworked my Code and save each child by ist own:

  Rezept := TTBLREZEPT.Create();
  Rezept.REZEPTID:=5;
  Rezept.BEZEICHNUNG:='Test 01';
  Rezept.SERIAL:=1;
  mgr.Save(Rezept);
  zutat := TTBLREZEPTZUTAT.Create();
  zutat.REZEPTID:=Rezept;
  zutat.LFDNR:=1;
  zutat.REZEPTPOSID:=4;
  zutat.HERKUNFTCD:=Rec;
  mgr.Save(zutat);

Is my first approach wrong?

Your first approach won't work because the generator of the child class is set to none. This prevents the cascade operation to work, because since you have set the ID of the child object, Aurelius thinks it should update (not save/insert) the record. That's why your second code is correct, you should explicitly tell Aurelius that you want to Save, not Update the object.

While this works, I am not happy with it. This makes it unconventient to use Aurelius with legacy DBs.

The problem ist, that I am forced to call SAVE for the master, before I can add the children to the master via SAVE. This potentially leads to a situation, that can´t made undone.

Given, there is a Validation error with a child and I want to not add the master to the DB.
If the Children are added without user interaction, I can use Transactions. 
Otherwise, I can delete the master, but this may fail.

Do you see my Point?

Maybe I can use a Aurelius dataset that holds my intermediate data? So I can insert master and Children and then POST everything to the DB. Or will I still have the problem with the IDs of the Children?

Yes, you can use Aurelius dataset to just edit objects and save them at a later point.

Of course, you should use database transactions to make sure all the objects are correctly save, or none of them.