Handling auto-incrementing field as primary key in cmp ejb

Discussions

EJB programming & troubleshooting: Handling auto-incrementing field as primary key in cmp ejb

  1. I was just wondering if there is anything special that needs to be done in handling this situation... On this table, the database auto-increments and assigns a value to the primary key field on create... Will the cmp ejb just return this value on a create call, or is there anything special that needs to be done to handle this situation properly?

    Thanks

    Nic
  2. Forget the combination of autocounter fields and CMP. It does not work and there has a lot written of lines been written here about the generation of primary keys for CMP beans.
  3. Nic,

    We are trying to do the same thing. It seems that auto-generated primary keys are not officially supported with EJB 2.0 CMP, but several vendors do support it. You might want to check out the following:

    http://www.mail-archive.com/ejbinterest at java dot sun dot com/msg19000.html

    http://edocs.bea.com/wls/docs61/ejb/cmp.html#1066165

    Good luck!

    Rick