1 Reply Latest reply on Mar 31, 2010 12:43 PM by Ramesh Reddy

    Autocreate ID possible with teiid?

    Immo Benjes Apprentice

      Hi,

       

      I've just discovered that the legacy database we are using doesn't generate unique primary keys by itself

      So I would have to get the last max id in the table increment it and try to check it in. Of course by that time someone else might have used that id already. Is there a way to generate auto ids with teiid and if so how would I do it? I guess the flag 'Autoincrement' in Teiid Designer just tells teiid that the db will do the autoincrement?

       

      Regards

       

      Immo

        • 1. Re: Autocreate ID possible with teiid?
          Ramesh Reddy Master

          If you create a virtual layer for the legacy database in Teiid, and have all your applications using Teiid and this virtual layer to access, then you can insert logic into the "update" transformation for this table to create the auto-increment id, however you want it. Like select the last max id, then incrementing it and inserting it in that update transformation.

           

          Currently there is no in-built support for this. However, if you like to see in future releases, please fill in a feature request in Teiid's JIRA. Yes, in Designer it is just metadata mentioning that it is auto-increment field.

           

          If you are using Hibernate on top of Teiid, it has lots of built-in strategies to create the auto-increment field, so you could use that.

           

          Hope this helps.

           

          Ramesh..