Win a copy of Rust Web Development this week in the Other Languages 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
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

WHAT HAPPENS IF FINDER METHD IN CMP BEANS HAVE AN INVALID ENTRY

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI
A PROBLEM IS CROPING UP.. I M USING FINDBYPRIMARYKEY METHOD IN CMP BEANS...NOW WHEN A INVALID ENTRY IS GIVEN THAT IS NOT PRESENT IN THE DATABASE IT GIVES AN EXCEPTION OF OBJECT NOT FOUND.....WELL BUT WHY IS IT SO THAT AFTER WARDS WHEN I GIVE A RIGHT ENTRY IT'S AGAIN GIVING AN EXCEPTION
REGARDS
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the in the database commit command is not given and you invoke findByXXX() methods ObjectNotFoundException is thrown.
i,e.
1. Table is created
2. record is inserted.
3. commit
in this case ObjectNotFoundException will not be thrown.
If step 3 is avoided then ObjectNotFoundException is thrown.
 
Sharad Naithani
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Venkataramu Pendiyala:
If the in the database commit command is not given and you invoke findByXXX() methods ObjectNotFoundException is thrown.
i,e.
1. Table is created
2. record is inserted.
3. commit
in this case ObjectNotFoundException will not be thrown.
If step 3 is avoided then ObjectNotFoundException is thrown.


Hi
what do u mean by giving a commit command...pls specify....
actually my problem is in my database i have 1 entry for id=31125

1>so in findbyprimarykey(int id) if i give id=31125...it fecthes me the record details
2>now if i give id=as 31126 any wrong entry..it throws an exception of objectnotfound coz there is no record as such....
3>but again if i give id=31125..this time it doesn't work some sqlpersistence excpetion is there
what to do please help>>>

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic