wrongclassexception.java
来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 44 行
JAVA
44 行
//$Id: WrongClassException.java,v 1.4.2.1 2003/11/27 09:30:48 oneovthafew Exp $package net.sf.hibernate;import java.io.Serializable;/** * Thrown when <tt>Session.load()</tt> selects a row with * the given primary key (identifier value) but the row's * discriminator value specifies a subclass that is not * assignable to the class requested by the user. * * @author Gavin King */public class WrongClassException extends HibernateException { private final Serializable identifier; private final Class clazz; public WrongClassException(String msg, Serializable identifier, Class clazz) { super(msg); this.identifier = identifier; this.clazz = clazz; } public Serializable getIdentifier() { return identifier; } public String getMessage() { return "Object with id: " + identifier + " was not of the specified subclass: " + clazz.getName() + " (" + super.getMessage() + ")" ; } public Class getPersistentClass() { return clazz; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?