Identity Fields in CMP / BMP Enttiy Beans

Discussions

EJB programming & troubleshooting: Identity Fields in CMP / BMP Enttiy Beans

  1. Identity Fields in CMP / BMP Enttiy Beans (1 messages)

    at the risk of sounding stupid. How does one handle fields such as an autoincrement or identity field when creating an Entity Bean, especially in the create functions. Is there some special way to deal with this with CMP, or does one need to hand write their own BMP Entity Bean??
  2. In O2R mapping, one usually employs a hight/low paired OID generator for generating object identifiers as opposed to a database feature (with side-effects) for generating relation keys.

    If you really need the autoincrement value (first, closely scrutinize such a requirement), put it in a non-key column.

    Still, you cannot achieve a running sequence with autoincrement columns: most RDBMSs (I know Sybase behaves like this for sure) will pre-allocate a block of running values for a given autoincement column and when you shutdown the RDBMS for any reason, you might jump ahead and have "holes" in the sequence when you start it up again.