0 Replies Latest reply on Dec 6, 2002 9:12 PM by CL Gilbert

    Primary Key Generation dead horse...

    CL Gilbert Newbie

      Yes, this topic again. I am settlign for a db specific solution. My DB is MySQL. But still I am not entirely sure how to do this.

      I plan on having a SSB execute the following:

      INSERT INTO KeysTable (id) values (NULL);
      SELECT distinct LAST_INSERT_ID() FROM KeysTable;

      This should return the key ready to use.

      Is this an acceptable solution for someone committed to mysql? Are their any issues with this? I am not concerned about performance issues yet, but info is good on that too.

      Is their any bean configurations I should be sure to set for this to work? I am DB transaction ignorant...

      What If I just made my entity beans ID null when it was stored? would autoincrement give it an id automatically? Even if it did, is their anyway for my CMP Bean to know?

      Im going a non-generic route, but I am just trying to get started and quickly as possible.

      On a side note. What books should I be reading to learn about database transactions and serialization and concurrency that everyone here seems to know about??? I know java and I know distributed computing, and I know schemas, but I dont know much about database robust usage.

      Thanks a million!