EJB programming & troubleshooting: CMP bean without a primary key & all columns nullable
Is it possible to make a CMP without a primary key and have all other columns nullable, is this supported by WAS 4.0
- Posted by: vaishali kumar
- Posted on: July 31 2002 03:09 EDT
- CMP bean without a primary key & all columns nullable by Daniel Lang on July 31 2002 06:16 EDT
- CMP bean without a primary key & all columns nullable by Tony Brookes on July 31 2002 18:24 EDT
- CMP bean without a primary key & all columns nullable by Thandaveswaran Venkatraman on August 04 2002 02:02 EDT
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?
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........
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.