2 Replies Latest reply on Apr 14, 2011 9:31 AM by nadirx

    Sybase autoincrement columns and Hibernate

    nadirx

      Dear all,

       

      I am accessing several Sybase databases through Teiid and in my app via Hibernate. These dbs have primary key columns declared as autoincrement.

       

      How should I configure Teiid and the Hibernate annotations of my entities to handle these correctly ?

       

      I guess I can use

       

      @Id

      @GeneratedValue(strategy=GenerationType.IDENTITY)

      Long id;

       

      What should I configure on the VDB to tell it to get the pk generated by the database ?

       

      Thanks in advance.

       

      Tristan

        • 1. Sybase autoincrement columns and Hibernate
          shawkins

          Tristan,

           

          Teiid does not yet have support for retrieving generated keys.  You could use the TABLE GenerationType or some other method that doesn't require a side effect of the INSERT.

           

          I'll create a JIRA to add support for generated keys that can be picked up by the Identity generation type.

           

          Steve

          • 2. Sybase autoincrement columns and Hibernate
            nadirx

            Hi Steve, we're now using the select generator, although it is quite limited in that it doesn't support composite natural ids. We'll see if we can fix it somehow.

            Thanks