ORM Virtual Table insert and sequences issue

Home Forums kbmMW ORM Virtual Table insert and sequences issue

Viewing 1 reply thread
  • Author
    Posts
    • #54129
      mrluigi2017
      Participant

      Hi,

      I have one table and a virtual table that look like this:

      [kbmMW_Table(‘name:email’)]
      [kbmMW_Root(’email’, [mwrfIncludeOnlyTagged])]
      TEmail = class

      Public

      [kbmMW_Field(‘name:email_id, primary:true, generator:sequence’, ftInteger)]
      [kbmMW_Element(’email_id’)]
      property EmailId: kbmMWNullable<integer> read FEmailId write FEmailId;

      Etc.

      [kbmMW_VirtualTable(TEmail)]
      [kbmMW_Root(’email_outgoing_email’, [mwrfIncludeOnlyTagged])]
      TEmailOutgoingEmail = class(TEmail)
      Etc.

      As far as I understood inserting a TEmailOutgoingEmail with the ORM will actually insert a TEmail. The strange thing is that I get an error that the generator S_TEMAILOUTGOINGEMAIL_EMAIL_ID is not defined. It looks like it tries to use the sequence of the virtual table instead of the non virtual one (the one I expected to be used).

      Am I doing something here that I shouldn’t? This construction worked fine in another project were I manually set the primary keys.

      Thanks in advance!

      Luigi

    • #54130
      kimbomadsen
      Keymaster

      Hi,

      Thank you for your report. You are correct. There is a bug.

      To fix, open kbmMWORM.pas, locate TkbmMWORMField.GetSequenceName and make the bolded adjustment. Then it will work as expected.

      function TkbmMWORMField.GetSequenceName:string;
      begin
      Result:=FFieldAttr.Sequence;
      if Result=” then
      Result:=’s_’+FTable.BaseTable.Name+’_’+FName;
      end;

      • This reply was modified 5 months, 2 weeks ago by kimbomadsen.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Skip to toolbar