KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > ObjectNotFoundException


1 //$Id: ObjectNotFoundException.java,v 1.2 2004/08/29 09:59:15 oneovthafew Exp $
2
package org.hibernate;
3
4 import java.io.Serializable JavaDoc;
5
6 /**
7  * Thrown when <tt>Session.load()</tt> fails to select a row with
8  * the given primary key (identifier value). This exception might not
9  * be thrown when <tt>load()</tt> is called, even if there was no
10  * row on the database, because <tt>load()</tt> returns a proxy if
11  * possible. Applications should use <tt>Session.get()</tt> to test if
12  * a row exists in the database.<br>
13  * <br>
14  * Like all Hibernate exceptions, this exception is considered
15  * unrecoverable.
16  *
17  * @author Gavin King
18  */

19 public class ObjectNotFoundException extends UnresolvableObjectException {
20
21     public ObjectNotFoundException(Serializable JavaDoc identifier, String JavaDoc clazz) {
22         super(identifier, clazz);
23     }
24
25     public static void throwIfNull(Object JavaDoc o, Serializable JavaDoc id, String JavaDoc clazz)
26     throws ObjectNotFoundException {
27         if (o==null) throw new ObjectNotFoundException(id, clazz);
28     }
29
30 }
31
32
33
34
35
36
37
38
Popular Tags