This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android 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 ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

ObjectNotFoundException Vs NoSuchEntityException

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ObjectNotFoundException: thrown when no entity in database matching primary key is found.
NoSuchEntityException: Thrown entity your are trying to access is no longer in database.

What is the difference??

Though one is checked and other is not but given a scenario only one can be thrown.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ObjectNotFoundException: Till now no entity in database matching primary key is exists in database

NoSuchEntityException: presently that entity is deleted,previsouly it will be in database

Correct me if i am wrong
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ObjectNotFoundException : this one is a finder exception. like when u use the find<method> and if the entity doesnt exist in the DB this exception or FinderException is got.

NoSuchEntityException this will be trown mostly from ejbLoad , ejbStore and from the methods that implement the business methods defined in the component interface when the entity being accessed is removed from the underlying store(ie after the entity has been found by the finder or created new, we have the ref to the entity already). The container may also throw NoSuchObject[Local]Exception to give a better idea to the client.


hope this helps
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic