• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

HF RJB - Page 549 - Error ??

Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DuplicateKeyException Paragraph
- Should not the text be
......certain that the bean was created
Rather than as in the book which says
.....certain that the bean was NOT Created
Cowgirl and Author
Posts: 1589
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy -- well now that you pointed this out, I can see that it's confusingly-worded. It's not an error, though, but it needs a little more explanation:
The point of that page is to show the result to the CLIENT for whatever action caused the exception.
If the client gets a DuplicateKeyException on a create() call, then the client can be CERTAIN the bean that the client was trying to create was NOT created.
But it IS confusing, because it DOES mean that at some earlier point, an entity with that key *was* created. But that doesn't necessarily mean that a *bean* with that key was created. The Container can throw that exception if the Container finds that it cannot do an INSERT of an entity in the database because there is already something with that same key. So it's possible that no bean was ever officially *created* or *realized* (loaded and populated) but that the entity does exist already in the database, so that when the client calls create() on a bean's Home, the Container is unable to do the INSERT, and thus no bean is created.
Does that help?
Good question! Thanks for pointing this out.
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic