~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to src/org/hibernate/WrongClassException.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//$Id: WrongClassException.java 5685 2005-02-12 07:19:50Z steveebersole $
 
2
package org.hibernate;
 
3
 
 
4
import java.io.Serializable;
 
5
 
 
6
/**
 
7
 * Thrown when <tt>Session.load()</tt> selects a row with
 
8
 * the given primary key (identifier value) but the row's
 
9
 * discriminator value specifies a subclass that is not
 
10
 * assignable to the class requested by the user.
 
11
 *
 
12
 * @author Gavin King
 
13
 */
 
14
public class WrongClassException extends HibernateException {
 
15
 
 
16
        private final Serializable identifier;
 
17
        private final String entityName;
 
18
 
 
19
        public WrongClassException(String msg, Serializable identifier, String clazz) {
 
20
                super(msg);
 
21
                this.identifier = identifier;
 
22
                this.entityName = clazz;
 
23
        }
 
24
        public Serializable getIdentifier() {
 
25
                return identifier;
 
26
        }
 
27
 
 
28
        public String getMessage() {
 
29
                return "Object with id: " +
 
30
                        identifier +
 
31
                        " was not of the specified subclass: " +
 
32
                        entityName +
 
33
                        " (" + super.getMessage() + ")" ;
 
34
        }
 
35
 
 
36
        public String getEntityName() {
 
37
                return entityName;
 
38
        }
 
39
 
 
40
}
 
41
 
 
42
 
 
43
 
 
44
 
 
45
 
 
46
 
 
47