Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Automatic Primary Key Generation

Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

When I tried using auto-generate to generate my IDs with CMP beans, I got an exception and so I looked for alternatives. I came across this:

In the deployment descriptor, the primary key class must be defined as a java.lang.Object. The primary key field is not specified.
In the home interface, the argument of the findByPrimaryKey method must be a java.lang.Object.
In the entity bean class, the return type of the ejbCreate method must be a java.lang.Object.
In these entity beans, the primary key values are in an internal field that only the EJB container can access. You cannot associate the primary key with a persistent field or any other instance variable. However, you can fetch the bean's primary key by invoking the getPrimaryKey method on the bean reference, and you can locate the bean by invoking its findByPrimaryKey method.

when I try to do that throught the WSAD for DB2, I get a problem which stops the generation of the deployment code..most probably bec. the table id is not mapped to a field in the bean. How can I bypass this problem?
    Bookmark Topic Watch Topic
  • New Topic