• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

DB2-generated sequential values with WAS 5.0 CMP EJB

Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to use CMP EJBs. I'd like to have a DB2 table that includes a primary key supplied by the EJB (contentID) and a second column (fileID)that has sequential integer values generated by DB2 (i.e., DB2 Identity values).
I know that I can't do a Top-Down mapping to get this, but thought I should be able to do a Bottom Up one. So, I created the table in DB2, generated the EJB using WSAD5.01 with the Bottom Up option. It generates the EJB and everything looks fine (e.g., it includes the expected create method in the EJB Home object that includes the single to-be-supplied key value --contentID). It also deploys fine.
However, when I try to run it in the TestServer and use the single valaue create method in Home, it generates the following error:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0798N A value cannot be specified for column "FILEID" which is defined as GENERATED ALWAYS. SQLSTATE=428C9
javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@124cbe71
But, I'm not supplying a value for fileID and no such method is visible in a class that I can see. I suppose the driver is doing this under the hood somewhere.
1) can anyone shed any light on what is going on here?
2) is it possible to generate a CMP EJB from a DB2 table that includes an autogenerated column?
3) if so, can you point me in the right direction to do it?
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic