Hi,
If I have the following hierarchy : Son inherits from Father, and GrandSon inherits from Son. And if I want to use the joined table strategy.
I would have something like :
[Entity]
[AutoMapping]
[Inheritance(TInheritanceStrategy.JoinedTables)]
TFather = class
private
FId : Integer;
[...]
[Entity]
[AutoMapping]
[PrimaryJoinColumn('Id_Father')]
[Inheritance(TInheritanceStrategy.JoinedTables)]
TSon = class(TFather)
private
//Some Fields, but no "FId" field since the primary key here is a foreign key referencing Father(Id)
The problem now is that if I do this :
[Entity]
[AutoMapping]
[PrimaryJoinColumn('Id_Son')]
TGrandSon = class(TSon)
I have the following exception at runtime when trying to update the database : "EColumnMetadataNotFound : Column "Id" not found in table metadata "Son" "
I assume it's because it cannot find a FId field in the TSon class.. but it's not supposed to have one in my case.
Any hint on what I should do to fix this issue ?
You just need [Inheritance] attribute to be in the base class of hierachy (TFather). You don't need to add it in TSon class.
Alright, thank you !