CMP bean without a primary key & all columns nullable


EJB programming & troubleshooting: CMP bean without a primary key & all columns nullable

  1. Is it possible to make a CMP without a primary key and have all other columns nullable, is this supported by WAS 4.0
  2. No, a CMP EntityBean must have a primary key. What is the point of having a database table without primary key - since you can't uniquely identify rows?

  3. There are many reasons for this kind of table.

    What about a table which is auditing changes to things. It just tends to be a table with increasing date time, and then other data. Typically under high load, a key (and the associated index it brings along with it) would be detrimental to performance.

    This type of table is typically replicated offline to a copy with indexes.

    Of course this isn't really the sort of table you'd want to use an EJB to access anyway........
  4. Yes this is possible with an ejb, because the uniqueness of an object is maintained by the primary key class of the ejb.
    But i say that it would be a bad design.