KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > StaleObjectStateException


1 //$Id: StaleObjectStateException.java,v 1.5 2005/02/12 07:19:50 steveebersole Exp $
2
package org.hibernate;
3
4 import java.io.Serializable JavaDoc;
5
6 import org.hibernate.pretty.MessageHelper;
7
8 /**
9  * A <tt>StaleStateException</tt> that carries information
10  * about a particular entity instance that was the source
11  * of the failure.
12  *
13  * @author Gavin King
14  */

15 public class StaleObjectStateException extends StaleStateException {
16     private final String JavaDoc entityName;
17     private final Serializable JavaDoc identifier;
18
19     public StaleObjectStateException(String JavaDoc persistentClass, Serializable JavaDoc identifier) {
20         super("Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)");
21         this.entityName = persistentClass;
22         this.identifier = identifier;
23     }
24
25     public String JavaDoc getEntityName() {
26         return entityName;
27     }
28
29     public Serializable JavaDoc getIdentifier() {
30         return identifier;
31     }
32
33     public String JavaDoc getMessage() {
34         return super.getMessage() + ": " +
35             MessageHelper.infoString(entityName, identifier);
36     }
37
38 }
39
40
41
42
43
44
45
46
Popular Tags