You are not logged in.
Pages: 1
I have this PODO:
TDomZone = class(TSynPersistent)
private
FParentZone: TDomZone;
FZoneType: RawUTF8;
FCode: RawUTF8;
FISOCode: RawUTF8;
FName: RawUTF8;
FLatitude: Double;
FLongitude: Double;
FAltitude: Double;
published
property ParentZone: TDomZone read FParentZone write FParentZone;
property &ZoneType: RawUTF8 read FZoneType write FZoneType;
property Code: RawUTF8 read FCode write FCode;
property ISOCode: RawUTF8 read FISOCode write FISOCode;
property Name: RawUTF8 read FName write FName;
property Latitude: Double read FLatitude write FLatitude;
property Longitude: Double read FLongitude write FLongitude;
property Altitude: Double read FAltitude write FAltitude;
end;
TSQLZone = class(TSQLRecord)
...
published
ParentZone: TSQLZone;
...
end;
...Interfaces...
...Repository...
...Factory...
TInterfaceFactory.RegisterInterfaces([TypeInfo(IDomZoneQuery), TypeInfo(IDomZoneCommand)]);
Self referencing attribute ParentZone. I'm using SOA. The framework throw Access Violation in some where else, I don't know why, but if I comment the RegisterInterfaces line, it works.
Stacktrace:
mORMot.JSONObjectFromClass(TClass($445F4244),$315BCC8)
mORMot.TJSONSerializer.WriteObject($323A044,[woDontStoreDefault])
mORMot.WriteProp($849C84)
mORMot.WritePropsFromRTTI(TClass($849B64))
mORMot.TJSONSerializer.WriteObject($32555E8,[woDontStoreDefault])
mORMot.TServiceMethodArgument.AddJSON($326B450,$3228C38,[woDontStoreDefault])
mORMot.TServiceMethodExecute.ExecuteJson((...),'[]',$326B450,$5BDF6A0 {''},False)
mORMot.TServiceFactoryServer.ExecuteMethod($320C460)
mORMot.ComputeResult
mORMot.TSQLRestServerURIContext.InternalExecuteSOAByInterface
mORMot.TSQLRestRoutingREST.ExecuteSOAByInterface
mORMot.TSQLRestServerURIContext.ExecuteCommand
mORMot.TSQLRestServer.URI($5BDFBE4)
mORMotHttpServer.TSQLHttpServer.Request($3246AC8)
SynCrtSock.THttpServerGeneric.Request($3246AC8)
SynCrtSock.THttpApiServer.Execute
System.Classes.ThreadProc($3786050)
System.ThreadWrapper($3228CF0)
:75370419 KERNEL32.BaseThreadInitThunk + 0x19
:7763662d ntdll.RtlGetAppContainerNamedObjectPath + 0xed
:776365fd ntdll.RtlGetAppContainerNamedObjectPath + 0xbd
How I should handle self referencing tables?
I love your framework, crazy it is free, thanks!
Offline
In the ORM, so for TSQLRecord, published fields inheriting from TSQLRecord are not true instances, but just a mapping to the ID, to create a one-to-one relationship at SQL level.
See the documentation.
Offline
Pages: 1