• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

help! the invoke of findByPrimaryKey() always throws ObjectNotFoundException

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use CMP Entity Bean, and I succeeded in writing query using EJB-QL. But the method of FindByPrimaryKey() is implemented by the container itself. Every time I call this method, it always throw ObjectNotFoundException, while the corresponding record surely exists in database.
anyone could help me?
thanks in advance
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"play",
Thanks for joining JavaRanch, but we have a naming policy that everybody must adhere to. Please take a quick look at this and edit your profile accordingly.
Thanks!
Simon
 
Simon Brown
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, as for your question, are you using a specific class for your primary key (other than, e.g. Integer, String, etc)? If so, check that the equals and hashcode methods are implemented properly.
Otherwise, double check that the data is indeed in the database that the entity bean is accessing.
Cheers
Simon
 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
both primary key wrapper class and String type throws ObjectNotFoundException
 
Get off me! Here, read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic