EAutoGeneratedValuesNotSupported FireBird

Hi,

What I'm doing wrong?

I get the error:

Project Server.exe raised exception class EAutoGeneratedValuesNotSupported with message 'SQLGeneration: Auto generated values are not supported on Firebird SQL Generator.'.

In the log I get:

INSERT INTO CUSTOMERS (
  FirstName, Name, SubName, LanguageID, PriorityIndicationID, PaymentPeriodType, PaymentPeriod, NumberOfInvoicesToPrint)
 VALUES (
  :A_FirstName, :A_Name, :A_SubName, :A_LanguageID, :A_PriorityIndicationID, :A_PaymentPeriodType, :A_PaymentPeriod, :A_NumberOfInvoicesToPrint)
A_FirstName = "" (ftString)
A_Name = "Testing Crav" (ftString)
A_SubName = "" (ftString)
A_LanguageID = "1" (ftInteger)
A_PriorityIndicationID = "6" (ftInteger)
A_PaymentPeriodType = "0" (ftSmallint)
A_PaymentPeriod = "30" (ftSmallint)
A_NumberOfInvoicesToPrint = "1" (ftSmallint)

Entity:

  [Entity]
  [Id('FID', TIdGenerator.IdentityOrSequence)]
  TBaseWithID = class (TBase)
  private
    [Column('ID')]
    FID: Integer;
    procedure SetID(const Value: Integer);
  public
    property ID: Integer read FID write SetID;
  end;

  [Entity]
  [Table('CUSTOMERS')]
  TCustomer = class (TBaseWithID)
  private
    [Column('FirstName')]
    FFirstName: String;
    [Column('Name')]
    FName: Nullable<String>;
    [Column('SubName')]
    FSubName: String;
    [Column('LanguageID', [TColumnProp.Required])]
    FLanguageID: Integer;
    [Column('PriorityIndicationID', [TColumnProp.Required])]
    FPriorityIndicationID: Integer;
    [Column('PaymentPeriodType', [TColumnProp.Required])]
    FPaymentPeriodType: SmallInt;
    [Column('PaymentPeriod', [TColumnProp.Required])]
    FPaymentPeriod: SmallInt;
    [Column('NumberOfInvoicesToPrint', [TColumnProp.Required])]
    FNumberOfInvoicesToPrint: SmallInt;

    [ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAll)]
    [ForeignJoinColumn('CustomerID', [TColumnProp.Required])]
    FCustomerToAddress: Proxy<TList<TCustomerToAddress>>;

    [ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAll)]
    [ForeignJoinColumn('CustomerID', [TColumnProp.Required])]
    FCustomerToAddress1: Proxy<TList<TCustomerToAddress1>>;

    [ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAll)]
    [ForeignJoinColumn('CustomerID', [TColumnProp.Required])]
    FCustomerToAddress3: Proxy<TList<TCustomerToAddress3>>;




    procedure SetFirstName(const Value: String);
    procedure SetName(const Value: Nullable<String>);
    procedure SetSubName(const Value: String);

    procedure SetLanguageID(const Value: Integer);
    procedure SetPaymentPeriod(const Value: SmallInt);
    procedure SetPaymentPeriodType(const Value: SmallInt);
    procedure SetPriorityIndicationID(const Value: Integer);
    procedure SetNumberOfInvoicesToPrint(const Value: SmallInt);

    function GetCustomerToAddress: TList<TCustomerToAddress>;
    function GetCustomerToAddress1: TList<TCustomerToAddress1>;
    function GetCustomerToAddress3: TList<TCustomerToAddress3>;

  public
    destructor Destroy; override;


    property FirstName: String read FFirstName write SetFirstName;
    property Name: Nullable<String> read FName write SetName;
    property SubName: String read FSubName write SetSubName;
    property LanguageID: Integer read FLanguageID write SetLanguageID;
    property PriorityIndicationID: Integer read FPriorityIndicationID write SetPriorityIndicationID;
    property PaymentPeriod: SmallInt read FPaymentPeriod write SetPaymentPeriod;
    property PaymentPeriodType: SmallInt read FPaymentPeriodType write SetPaymentPeriodType;
    property NumberOfInvoicesToPrint: SmallInt read FNumberOfInvoicesToPrint write SetNumberOfInvoicesToPrint;

    property CustomerToAddress: TList<TCustomerToAddress> read GetCustomerToAddress;
    property CustomerToAddress1: TList<TCustomerToAddress1> read GetCustomerToAddress1;
    property CustomerToAddress3: TList<TCustomerToAddress3> read GetCustomerToAddress3;
  end;
It's something with the autoinc of the ID.

More info:

We are using Firebird 3.0 and see that the primary key the Identity (3.0 and higher) is checked.

Hi,

Any idee where I must search or change something?
I want to test it with:

{ TMyFirebird3SQLGenerator }

procedure TMyFirebird3SQLGenerator.DefineColumnType(Column: TColumnMetadata);
begin
  case Column.FieldType of
    ftAutoInc: begin
      //
    end;
  else
    inherited DefineColumnType(Column);
  end;
end;


initialization
  TSQLGeneratorRegister.GetInstance.RegisterGenerator(TMyFirebird3SQLGenerator.Create);

end.

But on debugging I can't get into the code.

When I want to add new record I get the error:

 raised exception class EAutoGeneratedValuesNotSupported with message 'SQLGeneration: Auto generated values are not supported on Firebird SQL Generator.'.




Latest Aurelius version has native support for Firebird 3 and its differences between Firebird 2. You should use "Firebird3" dialect, instead of "Firebird". You can check more info here: http://www.tmssoftware.biz/business/aurelius/doc/web/configuring_sql_dialects.html.

Have you tried to use this?

Yep

I've use

  Aurelius.SQL.Firebird3,
  Aurelius.Schema.Firebird3

also

initialization
  (TSQLGeneratorRegister.GetInstance.GetGenerator('Firebird3') as TFirebird3SQLGenerator).UseIdentity := True;
  (TSQLGeneratorRegister.GetInstance.GetGenerator('Firebird3') as TFirebird3SQLGenerator).UseBoolean := True;

But nothings work.



Are you creating your connection explicitly passing 'Firebird3' as the dialect?

Is that the SQLDialect in the FDConnection? Now it is number 3.

Thanks for the tip. I think I found it.

class function TFireDacFirebirdConnection.CreateConnection: IDBConnection;
var
  DataModule: TFireDacFirebirdConnection;
begin
  DataModule := TFireDacFirebirdConnection.Create(nil);
  Result := TFireDacConnectionAdapter.Create(DataModule.Connection, 'Firebird3', DataModule);
end;

The 3 wasn't there. ;-)