hello, i'am a newby on this forum, so perhaps i made a
mistake in my code !.
I have two objects declared like this
[Entity, Table('session')]
[Id('FSessionId', TIdGenerator.IdentityOrSequence)]
TSession = Class(TinterfacedPersistent)
Private
[Column('SessionId', [TColumnProp.Unique,
TColumnProp.Required])]
FSessionId: Int64;
[ManyValuedAssociation([TAssociationProp.Lazy],
CascadeTypeAll, 'FSession')]
FEntretiens : Proxy<TList<TEntretien>>;
function GetEntretiens: TList<TEntretien>;
Public
property SessionId: Int64 read FSessionId write FSessionId;
property Entretiens : TList<TEntretien> read
GetEntretiens;
end;
[Entity, Table('Entretien')]
[Id('FId', TIdGenerator.IdentityOrSequence)]
TEntretien = class(TinterfacedPersistent)
private
[Column('Id', [TColumnProp.Unique, TColumnProp.Required])]
FId: Int64;
[Association([TAssociationProp.Required], [])]
[JoinColumn('SessionId', [TColumnProp.Required])]
FSession : Proxy<TSession>;
function GetCandidat: TProspect;
procedure SetCandidat(const
Value: TProspect);
Public
Property SessionId : Int64 read
FSessionId write FSessionId;
Property Candidat : TProspect
read GetCandidat write SetCandidat;
End ;
When I load the TSession list using this code :
SessionList
:=Manager.Find<TSession>.list;
for I := 0 to SessionList.Count-1
do
begin
Memo1.Lines.Add(SessionList.Libelle);
for J := 0 to
SessionList.Entretiens.Count-1 do
begin
Memo1.Lines.Add(SessionList.Entretiens[J].Libelle);
end;
end;
SessionList.Free;
I have a Stack overflow exception : it seems that the Tsession object is
detroy and recreated when the Tentretien is loaded and the «entretiens » list
is accessed…
Where i made a mistake ?
Thank you for your help !
PLT