aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Regarding PK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Regarding PK" Watch "Regarding PK" New topic
Author

Regarding PK

georgejk
Greenhorn

Joined: Jul 29, 2002
Posts: 24
Hi
Just look into the scenario in which i have set the primary key field as auto generated. In that case my CMP representing to that table is giving me error when i try to call the create method.
The create method is called by passing the other fields in that table. So in my point of view it should insert to that table with the values supplied. Because one trigger is created to generate the PK as automatic.
The error was primarykey field not initialized.
If anyone can suggest me an idea that would be fine.
Thanks
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Hi there...
Thanks for joining us here at the ranch, but could you just take a quick look at the naming policy and edit your profile accordingly.
Thanks!
Simon
Bartender (moderator) of "J2EE and EJB" forum
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1135

Hi George,
There are several "patterns" available for handling automatically generated, surrogate, primary keys. Here is an article that discusses the issue:
http://www.flashline.com/content/mclaughlin/bm050701.jsp?sid=1011641712765-216531326-51

And the book "EJB Design Patterns" by Floyd Marinescu also discusses this issue. You can download a PDF version of that book from here:
http://www2.theserverside.com/books/EJBDesignPatterns/index.jsp

Good Luck,
Avi.
 
 
subject: Regarding PK