Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding PK

 
georgejk
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic