Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RecordNotFoundException

 
mohini lalwani
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 .
 
Paul Clapham
Sheriff
Posts: 21567
33
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.
 
Jeffry Kristianto Yanuar
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 ]
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic