1 16 17 package org.springframework.orm; 18 19 import org.springframework.dao.OptimisticLockingFailureException; 20 21 28 public class ObjectOptimisticLockingFailureException extends OptimisticLockingFailureException { 29 30 private Object persistentClass; 31 32 private Object identifier; 33 34 35 41 public ObjectOptimisticLockingFailureException(String msg, Throwable cause) { 42 super(msg, cause); 43 } 44 45 51 public ObjectOptimisticLockingFailureException(Class persistentClass, Object identifier) { 52 this(persistentClass, identifier, null); 53 } 54 55 62 public ObjectOptimisticLockingFailureException( 63 Class persistentClass, Object identifier, Throwable cause) { 64 65 this(persistentClass, identifier, 66 "Object of class [" + persistentClass.getName() + "] with identifier [" + identifier + 67 "]: optimistic locking failed", cause); 68 } 69 70 78 public ObjectOptimisticLockingFailureException( 79 Class persistentClass, Object identifier, String msg, Throwable cause) { 80 81 super(msg, cause); 82 this.persistentClass = persistentClass; 83 this.identifier = identifier; 84 } 85 86 92 public ObjectOptimisticLockingFailureException(String persistentClassName, Object identifier) { 93 this(persistentClassName, identifier, null); 94 } 95 96 103 public ObjectOptimisticLockingFailureException( 104 String persistentClassName, Object identifier, Throwable cause) { 105 106 this(persistentClassName, identifier, 107 "Object of class [" + persistentClassName + "] with identifier [" + identifier + 108 "]: optimistic locking failed", cause); 109 } 110 111 119 public ObjectOptimisticLockingFailureException( 120 String persistentClassName, Object identifier, String msg, Throwable cause) { 121 122 super(msg, cause); 123 this.persistentClass = persistentClassName; 124 this.identifier = identifier; 125 } 126 127 128 132 public Class getPersistentClass() { 133 return (this.persistentClass instanceof Class ? (Class ) this.persistentClass : null); 134 } 135 136 140 public String getPersistentClassName() { 141 if (this.persistentClass instanceof Class ) { 142 return ((Class ) this.persistentClass).getName(); 143 } 144 return (this.persistentClass != null ? this.persistentClass.toString() : null); 145 } 146 147 150 public Object getIdentifier() { 151 return identifier; 152 } 153 154 } 155 | Popular Tags |