Inheritance and AbstractEntity question

Hello!

I have a problem with AbstractEntities. I have an existing class TPartner that I want to convert to a inheritence from a common class, here's the code:

  [Entity]
  [Table('partners')]
  [Id('FId', TIdGenerator.IdentityOrSequence)]
  TPartner = class(TBaseObject)
  private
    [Column('ID')]
    FId: integer;

    [Column('NAME')]
    FPartnerName: string;
  public
    property Id: integer read FId write FId;
    property PartnerName: string read FPartnerName write FPartnerName;
  end;

Here's the new code that doesn't work, the error on run-time is

---------------------------
Debugger Exception Notification
---------------------------
Project Easy.exe raised exception class EMappingNotFound with message 'Cannot find mapping [Id] on class TPartner.'.

I've checked the documentation in the PDF manual (page 45) and it seems the same to me, bout obviously I'm missing something here.. :slight_smile:

The new code is this:

  TBaseObject = class
  private
    [Transient]
    FIsNew: boolean;

    [Transient]
    FErrors: TStringList;

    [Transient]
    FSelected: boolean;

    [Transient]
    FSkipProcessing: boolean;

    [Transient]
    FChanged: boolean;
  public
    property Selected: boolean read FSelected write FSelected;  
    property IsNew: boolean read FIsNew write FIsNew;           
    property Errors: TStringList read FErrors write FErrors;
    property Skip: boolean read FSkipProcessing write FSkipProcessing;  
    property Changed: boolean read FChanged write FChanged;     
  end;

  [AbstractEntity]
  [Id('FId', TIdGenerator.IdentityOrSequence)]
  TEasyBase = class(TBaseObject)
  strict private
    [Column('ID')]
    FId: integer;
  public
    property Id: integer read FId write FId;
  end;


  [Entity]
  [Table('partners')]
  TPartner = class(TEasyBase)
  private
    [Column('NAME')]
    FPartnerName: string;
  public
    property PartnerName: string read FPartnerName write FPartnerName;
  end;

Indeed, I don't see a problem with your mapping at first sight. Please reduce it to a minimal compilable project that reproduces the problem and send it to us, so we can debug and check what's going on.

Isn't it because of the "strict" in base class ? It's not meant to be visible in a descendent class.

Shouldn't be this - I was using just "provate" and added "strict" after I've seen it somewhere :slight_smile:

I'm still worried about FId visibility with stric private, but could you try using Automapping in TPartner ? Once you didn't use an explicit Id custom attribute, maybe that could solve it. doc says it would inherit IDs definitions, but it's worth a try.