1 package org.hibernate; 3 4 import java.io.Serializable ; 5 6 import org.hibernate.pretty.MessageHelper; 7 8 15 public class StaleObjectStateException extends StaleStateException { 16 private final String entityName; 17 private final Serializable identifier; 18 19 public StaleObjectStateException(String persistentClass, Serializable 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 getEntityName() { 26 return entityName; 27 } 28 29 public Serializable getIdentifier() { 30 return identifier; 31 } 32 33 public String getMessage() { 34 return super.getMessage() + ": " + 35 MessageHelper.infoString(entityName, identifier); 36 } 37 38 } 39 40 41 42 43 44 45 46 | Popular Tags |