mapped to more than one database columns? - Revisited

I made the same mistake as I reported in mapped to more than one database columns? - #3

Is there anyway to make this error message more applicable as it is to do with the Values v Strings in the Enumeratrion Type rather than actual column mapping?

Do I understand that the problem is with Enumeration attribute? Can you please let us know exactly what was the "mistake" you refer to?

I added a value to the string values of an enumerated type, in this case 'CompleteWithErrors' but didn't add it to the actual TJobStatus enumeration. It is also longer than the field that holds the value.

[Enumeration(TEnumMappingType.emString, 'New,Queued,Processing,SentToProduction,Processed,Complete,**CompleteWithErrors**,Failed')]
TJobStatus = (New, Queued, Processing, SentToProduction, Processed, Complete, Failed);

the exception reported was

Property "GA.Entities.JobQueue.TJob.FStatus" is mapped to more than one database columns.

TJob is the object that has TJobStatus as a property.

Hope this helps

Can you please let me know the exception type? I just can't find such error message here.

That's the strange thing - it just comes up with the message as a dialog (as below) and doesn't stop the app, so isn't picked up by MadExcept either

---------------------------
Gashopserver
---------------------------
Property "GA.Entities.JobQueue.TJob.FStatus" is mapped to more than one database columns.
---------------------------
OK   
---------------------------

Let me see if I can step through

ok, trapped it:

EMultipleColumnsMemberException

Which version of TMS Aurelius are you using?

5.4, I'll install 5.6 and try that

Installed 5.6 and still get the same exception. Managed to get MadExcept to intercept it:

exception class    : EMultipleColumnsMemberException
exception message  : Property "GA.Entities.JobQueue.TJob.FStatus" is mapped to more than one database columns.

main thread ($ef8):
00d56725 +165 GAShopServer.exe XData.Aurelius.ModelBuilder      435 +22 TXDataModelBuilder.AddDeclaredProperties
00d577c6 +0b6 GAShopServer.exe XData.Aurelius.ModelBuilder      631  +7 TXDataModelBuilder.BuildEntityType
00d58353 +0c3 GAShopServer.exe XData.Aurelius.ModelBuilder      776  +7 TXDataModelBuilder.DefineEntityType
00d583f2 +052 GAShopServer.exe XData.Aurelius.ModelBuilder      786  +4 TXDataModelBuilder.DefineEntityTypeFromClass
00d575db +05b GAShopServer.exe XData.Aurelius.ModelBuilder      612  +3 TXDataModelBuilder.Build
00d74c87 +0a7 GAShopServer.exe XData.Aurelius.Model             706  +8 TXDataModelManager.Get
00d72bde +01e GAShopServer.exe XData.Aurelius.Model             316  +1 TXDataAureliusModel.Default
00ee1b8a +01a GAShopServer.exe XData.Comp.Server                451  +2 TXDataCustomServer.GetModel
00ee111f +05f GAShopServer.exe XData.Comp.Server                258  +1 TXDataCustomServer.CreateSparkleModule
0089af6c +01c GAShopServer.exe Sparkle.Comp.Server              272  +1 TSparkleServer.CreateModule
0089b598 +018 GAShopServer.exe Sparkle.Comp.Server              398  +1 TSparkleDispatcher.AddDispatcherModule
0089b601 +051 GAShopServer.exe Sparkle.Comp.Server              406  +2 TSparkleDispatcher.AddDispatcherModules
008ad5d4 +044 GAShopServer.exe Sparkle.Comp.HttpSysDispatcher    56  +5 TSparkleHttpSysDispatcher.DoStart
0089b9f8 +068 GAShopServer.exe Sparkle.Comp.Server              477  +7 TSparkleDispatcher.SetActive
0089ba32 +012 GAShopServer.exe Sparkle.Comp.Server              485  +1 TSparkleDispatcher.Start

Hope this helps

Can you please provide the full mapping of entity GA.Entities.JobQueue.TJob?

See below. This is only raised when the TJobStatus is defined incorrectly:

[Enumeration(TEnumMappingType.emString, 'New,Queued,Processing,SentToProduction,Processed,Complete,CompleteWithErrors,Failed')]
  TJobStatus = (New, Queued, Processing, SentToProduction, Processed, Complete, Failed);

Remove CompleteWithErrors and all is fine

  [Entity]
  [Table('JOBSQUEUE')]
  [EntityAuthorizeScopes(SCOPE_ALL_USERS, EntitySetPermissionsAll)]
  [Sequence('SEQ_JOB')]
  [Id('FId', TIdGenerator.IdentityOrSequence)]
  TJob = class
  private
    [Column('ID')]
    FId: Integer;
    [Column('JOBTYPE', [], 25)]
    FJobType: String;
    [Column('SUBMITTEDBY')]
    FSubmittedBy: Integer;
    [Column('DATESUBMITTED')]
    FDateSubmitted: TDateTime;
    [Column('JOBSTATUS')]
    FStatus: TJobStatus;
    [Column('TIMETAKEN')]
    FTimeTaken: Double;
    [Column('DATERUN')]
    FDateRun: Nullable<TDateTime>;
    [Column('VISIBILITY')]
    FVisibility: TJobVisibility;
    [Column('DATA', [], 4096)]
    FData: string;
    [Column('OUTPUTOPTION', [], 50)]
    FOutputOption: string;
    [Column('COMPLETEDBY')]
    FCompletedBy: Integer;
    [Column('OWNEDBY')]
    FOwnedBy: Integer;
    [Column('TITLE')]
    FTitle: String;
    [Column('NOTIFYONCOMPLETION')]
    FNotifyOnCompletion: Boolean;
    [Column('DATECOMPLETED')]
    FDateCompleted: Nullable<TDateTime>;
    [Column('HASERRORS')]
    FHasErrors: Nullable<Boolean>;
  public
    procedure Assign(Source: TObject);
    property Id: Integer read FId write FId;
    property JobType: String read FJobType write FJobType;
    property Title: String read FTitle write FTitle;
    property Visibility: TJobVisibility read FVisibility write FVisibility;
    property SubmittedBy: Integer read FSubmittedBy write FSubmittedBy;
    property DateSubmitted: TDateTime read FDateSubmitted write FDateSubmitted;
    property OwnedBy: Integer read FOwnedBy write FOwnedBy;
    property CompletedBy: Integer read FCompletedBy write FCompletedBy;
    property DateRun: Nullable<TDateTime> read FDateRun write FDateRun;
    property DateCompleted: Nullable<TDateTime> read FDateCompleted write FDateCompleted;
    property TimeTaken: Double read FTimeTaken write FTimeTaken;
    property Status: TJobStatus read FStatus write FStatus;
    property HasErrors: Nullable<Boolean> read FHasErrors write FHasErrors;
    property Data: string read FData write FData;
    property NotifyOncompletion: Boolean read FNotifyOnCompletion write FNotifyOnCompletion;
    property OutputOption: string read FOutputOption write FOutputOption;
  end;

I'm sorry but the error we get here is, the following, it's the correct one. Please review your code and send us a complete small project that can reproduce the problem you are experiencing.

very strange. I'll review, but it is exactly as shown above