File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes PRIMARY KEY Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "PRIMARY KEY" Watch "PRIMARY KEY" New topic
Author

PRIMARY KEY

Sanjay Deshpande
Ranch Hand

Joined: May 22, 2001
Posts: 111
i am yet to understand the concept of Primary key in EJB.
Does that mean i gotta have a n extra field in database to have ejbPrimary key also?
Can i omit primary key?
if i have a table emo :empid, empname then should i have field for ejb primary key?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

1. No. However, each row in the table must be uniquely identifiable
2. Not for Entity Beans
3. Deduce from 2, above!
You need not have a single column-key, but you do have to be able to construct a class comprised of columns from the database table that uniquely identify a row. For example, if I had multiple "projects" each of which had "options", but the "option" ID wasn't unique, I'd build the PK from project and option.
A primary key need have nothing to do with database keyfields, though often it maps to one for performance reasons. What is important is that the key uniquely identifies an EJB.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PRIMARY KEY
 
Similar Threads
Composite primary key and auto generation
Primary Key Class in CMP & BMP
two or more primary keys
primary key class of entity beans?
Why EJB require Primary key class