1 Reply Latest reply on Feb 7, 2003 1:12 PM by darryl_staflund

    Postgres auto-incrementing PK?

    pwaldo

      Hi all,

      I'm trying to get a bean using CMP to have its primary key (an integer) generated by the container. I'm not having much luck :-(

      After numerous google searches, this URL is the only one that really has any meat to it:
      http://www.kylev.com/projects/jboss/cmpauto.html

      Apparently a plugin is required to do the actual dirty work at the database level. Does anyone know if there is a Postgres plugin that will do the same thing? Thanks in advance!

      Paul

        • 1. Re: Postgres auto-incrementing PK?
          darryl_staflund

          Hi there,

          From my readings of the JBoss forums, JBoss 3.0.x doesn't support auto-incrementing PK keys. I understand it's at least partially supported in 3.2.x, although I seem to recall that JBoss' handling of PostgreSQL in this respect has some peculiarities about it. Search the EJB forum instead of the CMP forum and see what you come up with. serverside.com has previously made available a free PDF version of 'EJB Design Patterns'. It contains a section on how to manage primary keys in EJBs and even includes some EJB code (in its associated download) that handles primary key generation and assignment.

          Darryl