Discussions
EJB programming & troubleshooting: CMP bean without a primary key & all columns nullable
-
CMP bean without a primary key & all columns nullable (3 messages)
- Posted by: Vaishali Kumar
- Posted on: July 31 2002 03:09 EDT
Is it possible to make a CMP without a primary key and have all other columns nullable, is this supported by WAS 4.0Threaded Messages (3)
- 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
-
CMP bean without a primary key & all columns nullable[ Go to top ]
- Posted by: Daniel Lang
- Posted on: July 31 2002 06:16 EDT
- in response to Vaishali Kumar
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?
Daniel. -
CMP bean without a primary key & all columns nullable[ Go to top ]
- Posted by: Tony Brookes
- Posted on: July 31 2002 18:24 EDT
- in response to Daniel Lang
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........ -
CMP bean without a primary key & all columns nullable[ Go to top ]
- Posted by: Thandaveswaran Venkatraman
- Posted on: August 04 2002 02:02 EDT
- in response to Vaishali Kumar
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.