• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

primary key generation in CMP

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using db2 sequence for primary key generation. Session bean gets next sequence number and put it into create method of entity bean.
I wonder if it make sense to put this call inside create method and remove pk from parameters list. Please keep in mind that it’s CMP.
thx in advance
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of course this would be the right approach ,
what is the use of passing one more parameter from bean to bo man ?
and so what if it is cmp , u dont pass the primary key but pass all other things , and then take the key from ur id generator and use it there only.
we do the same in our case
so enjoy
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andron : Would you tell me how to get the next sequence number you described in your message?


Thanks
Benson
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The minimum requirement for the ejbCreate() method is to make the PK and assign it to the primary key field. You will, however, return null from this method in order to be compliant with the EJB spec.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WARNING! This will NOT work in all CMP implementations! For instance, WebSphere does not support this. Currently there are vendor-specific support for this in some servers, but not in all. This is outside the 2.0 CMP spec, and is not guaranteed to be portable!

Kyle
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic