• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primary Key class

 
Claudio Malso
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could anyone explain me why the definition of the PK can be deferred until deployment ?
 
Rich Raposa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, that's pretty vague question. I assume you are talking about entity beans? Most deployment tools let you pick an attribute of the bean class as the primary key for the class. This means either no separate PK class is needed, or the deployment can easily generate a PK class for you.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I think Roger is referring to Section 10.8.3 Special case: Unknown primary key class of the EJB Specification.
The benefit of an undefined Primary Key is that is allows the Deployer to map the PK to their specific environment, be it an Object Database or an RDBMS.
This also imposes quite a few limitations on the Bean Provider, most restricting of all is that a PK can not be explicitly created in your code since you don't know what the PK is until deployment time.
[ January 20, 2003: Message edited by: Chris Mathews ]
 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to code for findByPrimaryKey method before PK is defined? please help to understand, thanks
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Object as type of Key in all methods
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic