thotsaphon / delphi-orm

Automatically exported from code.google.com/p/delphi-orm
0 stars 0 forks source link

belongs_to relation not works for ObjectList sample #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If I add next section to sample.mapping file, then nothing happens on 
LoadRelation method, cause "Owner" name turn on CoC strategy and turn on 
lazyload too

"Has_one": [{
"Name": "Owner",
"Class_name": "TPerson",
"Child_field_name": "ID",
"Lazy_load": false}]

if i add new propery to TLaptop (Person instead Owner) and add next section to 
sample.mapping file instead of previous section

"Has_one": [{
"Name": "Person",
"Class_name": "TPerson",
"Child_field_name": "ID",
"Lazy_load": false}]

then i got recursive executions started at 

function TSession.Load(ATypeInfo: PTypeInfo; const Value: TValue): TObject;

look at this lines:

  if assigned(Result) then
  begin
    _idValue := GetIdValue(_table.Id, Result);
    LoadBelongsToRelation(_table, _idValue, rt, Result);
    LoadHasManyRelation(_table, _idValue, rt, Result);
    LoadHasOneRelation(_table, _idValue, rt, Result);
  end;

so after load belongs_to relation for TLaptop DORM starts load relations for 
TPerson result object and then try to load relation for TLaptop again and so on 
and so on..

any advice?

Original issue reported on code.google.com by dur...@gmail.com on 16 Jul 2012 at 2:43

GoogleCodeExporter commented 9 years ago
Hi,

checkout the last version, it should be fixed.

Original comment by daniele....@gmail.com on 10 Aug 2012 at 10:44

GoogleCodeExporter commented 9 years ago

Original comment by daniele....@gmail.com on 16 Aug 2012 at 8:58