Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

RecordNotFoundException

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I implemented RecordNotFoundException as :

public class RecordNotFoundException extends Exception {

/**
* A version number for this class so that serialization can occur without
* worrying about the underlying class changing between serialization and
* deserialization.
*/
private static final long serialVersionUID = 1L;

/**
* Creates a default <code>RecordNotFoundException</code> instance.
*/
public RecordNotFoundException()
{
super();
}

/**
* takes a String that serves as the exception's description.
* @param message
*/
public RecordNotFoundException(String message)
{
super(message);
}
}


is it okay ???

please give your inputs .
 
Marshal
Posts: 25594
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"pkarnani", please check your private messages for an important administrative matter.
 
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by pkarnani:
I implemented RecordNotFoundException as :

public class RecordNotFoundException extends Exception {

/**
* A version number for this class so that serialization can occur without
* worrying about the underlying class changing between serialization and
* deserialization.
*/
private static final long serialVersionUID = 1L;

/**
* Creates a default <code>RecordNotFoundException</code> instance.
*/
public RecordNotFoundException()
{
super();
}

/**
* takes a String that serves as the exception's description.
* @param message
*/
public RecordNotFoundException(String message)
{
super(message);
}
}


is it okay ???

please give your inputs .



It is okay or not is depend on your reason to do that. May I know your reason ?

In my implementation, I didn't created the RecordNotFoundException that use serialVersionUID. I assume that the class is fix and will never change in the future.


Good Luck


Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2) --> Waiting for the result since 15-Nov-2008
[ December 15, 2008: Message edited by: Jeffry Kristianto Yanuar ]
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I think it's ok. Since Exception implements Serializable, I also added to my RecordNotFoundException class a serialVersionUID, which was generated by Eclipse. The only difference is that I have a DatabaseException that extends Exception, then I have RecordNotFoundException, DatabaseNotFoundException, DuplicateKeyException, InvalidDatabaseException, IODatabaseException and RoomAlreadyBookedException extending DatabaseException, each exception to be used in a particular scenario.
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic