#1 2016-08-25 08:29:30

thomasbouclet
Member
Registered: 2016-08-24
Posts: 5

ORM, record and Aggregat

Hello,

I try to use ORM function in TDDDRepositoryRestQuery with my aggregat.

I have no problems when i use a simple TSQLRecord but i must register a TObjectList or Array of (Object) in TSQLRecord.

TPerson= class(TObject)
private
  FName: RawUTF8
published
  property Name : RawUTF8 read FName write FName;

end;

TPersons = array of TPerson;

TFamilly = class(TSQLRecord)
private 
  FName: RAWUTF8;
  FMembers: TPersons;
Published
  property Name: RawUTF8 read FName write FName;
  property Members: TPersons read FMembers write FMembers;
end;

When i use ORMGetAllAggregates, my aggregat.Count (7362704) but in my sql3 database i have 7 rows.

I try with TFamilly.CreateandFillPrepare and i have 7 rows but my array is empty.

How to register and recover array of object ?

Offline

#2 2016-08-25 10:24:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: ORM, record and Aggregat

Did you register the TPersons type using TJSONSerializer.RegisterObjArrayForJSON() ?

Offline

#3 2016-08-25 13:11:34

thomasbouclet
Member
Registered: 2016-08-24
Posts: 5

Re: ORM, record and Aggregat

Yes, I did.

I just see a strange thing.
If i have one row, the name look like 'ðPY'#0#0#0#0#0'ðPY'#0'ðPY'#0'Àã'#.

If i have many row my aggregat is empty.

Offline

#4 2016-08-25 15:07:15

thomasbouclet
Member
Registered: 2016-08-24
Posts: 5

Re: ORM, record and Aggregat

Ok, i find.

ORMGetAllAggregates don't must have a TObjectList Parameter.

If a use an array of Tpersons for example, it's works.

Offline

#5 2016-08-26 08:41:10

thomasbouclet
Member
Registered: 2016-08-24
Posts: 5

Re: ORM, record and Aggregat

I have a new problem, if i use a TInterfacedCollection or TObjectList in TFamilly, my TPerson is not register in sql3 database, value = [].

ObjectToJSON(TFamilly.Members), it's works.

Using TJSONSerializer.RegisterClassForJSON or TJSONSerializer.RegisterCollectionForJSON.

SomeBody have an idea ?

Offline

Board footer

Powered by FluxBB