Cannot find mapping [Id] on derived class bug ?

Hi,

Have this code that used to work on older versions of Aurelius on Delphi 10.3. Now, trying to run with newest version of Aurelius on Delphi 10.4 raises an exception: "Cannot find mapping [Id] on class TDerivedClass"

Here is the (pseudo)code:

  [Entity]
  [Table('BASE_TABLE')]
  [Sequence('ID_BASE_TABLE')]
  [Inheritance(TInheritanceStrategy.SingleTable)]
  [DiscriminatorColumn('CLASSE', TDiscriminatorType.dtInteger)]
  [Id('FId', TIdGenerator.IdentityOrSequence)]
  TBaseClass = class (TSomeCustomObject)
  private
    [Column('ID', ColumnPropPrimaryKey)]
    FId: TId;
  {...}

  [Entity]
  [DiscriminatorValue(Ord(TClasse.Classe1))]
  TDerivedClass = class (TBaseClass)
  {
  Fields with no FId field already defined on TBaseClass
  }

The exception is raised on creating the TXDataServerModule

Regards,

Digging deeper I found an specific scenario where the problem occurs:

TBaseClass cannot have a link to TDerivedClass, like that:

  TDirivedClass = class;

  [Entity]
  [Table('BASE_TABLE')]
  [Sequence('ID_BASE_TABLE')]
  [Inheritance(TInheritanceStrategy.SingleTable)]
  [DiscriminatorColumn('CLASSE', TDiscriminatorType.dtInteger)]
  [Id('FId', TIdGenerator.IdentityOrSequence)]
  TBaseClass = class (TSomeCustomObject)
  private
    [Column('ID', ColumnPropPrimaryKey)]
    FId: TId;

    [Association([TAssociationProp.Lazy])]
    [JoinColumn('SOME_COLUMN')]
    FDerived: Proxy<TDerivedClass>;  // Here is the problem (don't know if by design)

    {...}
1 Like

It's a regression bug indeed. We are investigating and will come up with a fix as soon as possible.

1 Like

It has been fixed in recent release.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.