The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Primary Key class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "Primary Key class" Watch "Primary Key class" New topic
Author

Primary Key class

Claudio Malso
Ranch Hand

Joined: Nov 05, 2002
Posts: 50
could anyone explain me why the definition of the PK can be deferred until deployment ?


Claudio
Rich Raposa
Ranch Hand

Joined: Dec 06, 2001
Posts: 46
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.


Rich Raposa<br /><a href="http://www.javalicense.com" target="_blank" rel="nofollow">http://www.javalicense.com</a><br />Buy Java courseware -> get a free XBox!
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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

Joined: Oct 14, 2002
Posts: 157
how to code for findByPrimaryKey method before PK is defined? please help to understand, thanks


SCJP<br />SCWCD<br />SCEA
Shakti Sharma
Ranch Hand

Joined: Dec 19, 2000
Posts: 60
Use Object as type of Key in all methods
 
IntelliJ Java IDE
 
subject: Primary Key class
 
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture