Identifier value of newly created object

Hi,


I'm wondering how to retrieve the identifier value of a newly created and saved object.


i.e.

//following simple class

  [Entity]
  [Table('BATCH')]
  [Sequence('SEQ_BATCH_ID')]
  [Id('FId', TIdGenerator.IdentityOrSequence)]
  TBatch = class
  private
    [Column('ID',[TColumnProp.Unique, TColumnProp.Required ] ) ]
    FId:Integer;

    [Column('NAME', [])]
    FBatchName: string;

  public
    property Id : integer read FId;
    property BatchName :string read FBatchName write FBatchName;
  end;

...
  procedure TForm.Test()
  begin
  aBatch := TBatch.Create();
  aBatch.Name:= 'New batch';
 
  Objectmanager.update(aBatch);
  ObjectManager.Flush();

//now i expect the ID value to be filled but sadly it isn't
  showmessage( format( 'Batch.Id = %d',[aBatch.Id]));//

  end;


TIA




You must use Objectmanager.Save to insert a new object into the database.

Tnx!