1 21 package oracle.toplink.essentials.exceptions; 23 24 import java.util.Vector ; 25 import java.lang.reflect.*; 26 import oracle.toplink.essentials.mappings.DatabaseMapping; 27 import oracle.toplink.essentials.internal.queryframework.*; 28 import oracle.toplink.essentials.internal.identitymaps.*; 29 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject; 30 import oracle.toplink.essentials.queryframework.*; 31 import oracle.toplink.essentials.exceptions.i18n.ExceptionMessageGenerator; 32 import oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl; 33 import oracle.toplink.essentials.internal.sessions.AbstractSession; 34 import oracle.toplink.essentials.descriptors.ClassDescriptor; 35 import oracle.toplink.essentials.sessions.Session; 36 37 41 public class ValidationException extends TopLinkException { 42 public static final int LOGIN_BEFORE_ALLOCATING_CLIENT_SESSIONS = 7001; 43 public static final int POOL_NAME_DOES_NOT_EXIST = 7002; 44 public static final int MAX_SIZE_LESS_THAN_MIN_SIZE = 7003; 45 public static final int POOLS_MUST_BE_CONFIGURED_BEFORE_LOGIN = 7004; 46 public static final int JAVA_TYPE_IS_NOT_A_VALID_DATABASE_TYPE = 7008; 47 public static final int MISSING_DESCRIPTOR = 7009; 48 public static final int START_INDEX_OUT_OF_RANGE = 7010; 49 public static final int STOP_INDEX_OUT_OF_RANGE = 7011; 50 public static final int FATAL_ERROR_OCCURRED = 7012; 51 public static final int NO_PROPERTIES_FILE_FOUND = 7013; 52 public static final int CHILD_DESCRIPTORS_DO_NOT_HAVE_IDENTITY_MAP = 7017; 53 public static final int FILE_ERROR = 7018; 54 public static final int INCORRECT_LOGIN_INSTANCE_PROVIDED = 7023; 55 public static final int INVALID_MERGE_POLICY = 7024; 56 public static final int ONLY_FIELDS_ARE_VALID_KEYS_FOR_DATABASE_ROWS = 7025; 57 public static final int SEQUENCE_SETUP_INCORRECTLY = 7027; 58 public static final int WRITE_OBJECT_NOT_ALLOWED_IN_UNIT_OF_WORK = 7028; 59 public static final int CANNOT_SET_READ_POOL_SIZE_AFTER_LOGIN = 7030; 60 public static final int CANNOT_ADD_DESCRIPTORS_TO_SESSION_BROKER = 7031; 61 public static final int NO_SESSION_REGISTERED_FOR_CLASS = 7032; 62 public static final int NO_SESSION_REGISTERED_FOR_NAME = 7033; 63 public static final int CANNOT_ADD_DESCRIPTORS_TO_SESSION = 7034; 64 public static final int CANNOT_LOGIN_TO_A_SESSION = 7035; 65 public static final int CANNOT_LOGOUT_OF_A_SESSION = 7036; 66 public static final int CANNOT_MODIFY_SCHEMA_IN_SESSION = 7037; 67 public static final int LOG_IO_ERROR = 7038; 68 public static final int CANNOT_REMOVE_FROM_READ_ONLY_CLASSES_IN_NESTED_UNIT_OF_WORK = 7039; 69 public static final int CANNOT_MODIFY_READ_ONLY_CLASSES_SET_AFTER_USING_UNIT_OF_WORK = 7040; 70 public static final int INVALID_READ_ONLY_CLASS_STRUCTURE_IN_UNIT_OF_WORK = 7041; 71 public static final int PLATFORM_CLASS_NOT_FOUND = 7042; 72 public static final int NO_TABLES_TO_CREATE = 7043; 73 public static final int ILLEGAL_CONTAINER_CLASS = 7044; 74 public static final int CONTAINER_POLICY_DOES_NOT_USE_KEYS = 7047; 75 public static final int MAP_KEY_NOT_DECLARED_IN_ITEM_CLASS = 7048; 76 public static final int MISSING_MAPPING = 7051; 77 public static final int ILLEGAL_USE_OF_MAP_IN_DIRECTCOLLECTION = 7052; 78 public static final int CANNOT_RELEASE_NON_CLIENTSESSION = 7053; 79 public static final int CANNOT_ACQUIRE_CLIENTSESSION_FROM_SESSION = 7054; 80 public static final int OPTIMISTIC_LOCKING_NOT_SUPPORTED = 7055; 81 public static final int WRONG_OBJECT_REGISTERED = 7056; 82 public static final int KEYS_MUST_MATCH = 7057; 83 public static final int INVALID_CONNECTOR = 7058; 84 public static final int INVALID_DATA_SOURCE_NAME = 7059; 85 public static final int CANNOT_ACQUIRE_DATA_SOURCE = 7060; 86 public static final int JTS_EXCEPTION_RAISED = 7061; 87 public static final int FIELD_LEVEL_LOCKING_NOTSUPPORTED_OUTSIDE_A_UNIT_OF_WORK = 7062; 88 public static final int EJB_CONTAINER_EXCEPTION_RAISED = 7063; 89 public static final int EJB_PRIMARY_KEY_REFLECTION_EXCEPTION = 7064; 90 public static final int EJB_CANNOT_LOAD_REMOTE_CLASS = 7065; 91 public static final int EJB_MUST_BE_IN_TRANSACTION = 7066; 92 public static final int EJB_INVALID_PROJECT_CLASS = 7068; 93 public static final int PROJECT_AMENDMENT_EXCEPTION_OCCURED = 7069; 94 public static final int EJB_TOPLINK_PROPERTIES_NOT_FOUND = 7070; 95 public static final int CANT_HAVE_UNBOUND_IN_OUTPUT_ARGUMENTS = 7071; 96 public static final int EJB_INVALID_PLATFORM_CLASS = 7072; 97 public static final int ORACLE_OBJECT_TYPE_NOT_DEFINED = 7073; 98 public static final int ORACLE_OBJECT_TYPE_NAME_NOT_DEFINED = 7074; 99 public static final int ORACLE_VARRAY_MAXIMIM_SIZE_NOT_DEFINED = 7075; 100 public static final int DESCRIPTOR_MUST_NOT_BE_INITIALIZED = 7076; 101 public static final int EJB_INVALID_FINDER_ON_HOME = 7077; 102 public static final int EJB_NO_SUCH_SESSION_SPECIFIED_IN_PROPERTIES = 7078; 103 public static final int EJB_DESCRIPTOR_NOT_FOUND_IN_SESSION = 7079; 104 public static final int EJB_FINDER_EXCEPTION = 7080; 105 public static final int CANNOT_REGISTER_AGGREGATE_OBJECT_IN_UNIT_OF_WORK = 7081; 106 public static final int MULTIPLE_PROJECTS_SPECIFIED_IN_PROPERTIES = 7082; 107 public static final int NO_PROJECT_SPECIFIED_IN_PROPERTIES = 7083; 108 public final static int INVALID_FILE_TYPE = 7084; 109 public final static int SUB_SESSION_NOT_DEFINED_FOR_BROKER = 7085; 110 public final static int EJB_INVALID_SESSION_TYPE_CLASS = 7086; 111 public final static int EJB_SESSION_TYPE_CLASS_NOT_FOUND = 7087; 112 public final static int CANNOT_CREATE_EXTERNAL_TRANSACTION_CONTROLLER = 7088; 113 public final static int SESSION_AMENDMENT_EXCEPTION_OCCURED = 7089; 114 public final static int SET_LISTENER_CLASSES_EXCEPTION = 7091; 115 public final static int EXISTING_QUERY_TYPE_CONFLICT = 7092; 116 public final static int QUERY_ARGUMENT_TYPE_NOT_FOUND = 7093; 117 public final static int ERROR_IN_SESSION_XML = 7094; 118 public final static int NO_SESSIONS_XML_FOUND = 7095; 119 public final static int CANNOT_COMMIT_UOW_AGAIN = 7096; 120 public static final int OPERATION_NOT_SUPPORTED = 7097; 121 public static final int PROJECT_XML_NOT_FOUND = 7099; 122 public static final int NO_SESSION_FOUND = 7100; 123 public static final int NO_TOPLINK_EJB_JAR_XML_FOUND = 7101; 124 public static final int NULL_CACHE_KEY_FOUND_ON_REMOVAL = 7102; 125 public static final int NULL_UNDERLYING_VALUEHOLDER_VALUE = 7103; 126 public static final int INVALID_SEQUENCING_LOGIN = 7104; 127 128 public static final int INVALID_ENCRYPTION_CLASS = 7105; 130 public static final int ERROR_ENCRYPTING_PASSWORD = 7106; 131 public static final int ERROR_DECRYPTING_PASSWORD = 7107; 132 public static final int NOT_SUPPORTED_FOR_DATASOURCE = 7108; 133 public static final int PROJECT_LOGIN_IS_NULL = 7109; 134 135 public static final int HISTORICAL_SESSION_ONLY_SUPPORTED_ON_ORACLE = 7110; 137 public static final int CANNOT_ACQUIRE_HISTORICAL_SESSION = 7111; 138 public static final int FEATURE_NOT_SUPPORTED_IN_JDK_VERSION = 7112; 139 public static final int PLATFORM_DOES_NOT_SUPPORT_CALL_WITH_RETURNING = 7113; 140 public static final int ISOLATED_DATA_NOT_SUPPORTED_IN_CLIENTSESSIONBROKER = 7114; 141 public static final int CLIENT_SESSION_CANNOT_USE_EXCLUSIVE_CONNECTION = 7115; 142 143 public static final int INVALID_METHOD_ARGUMENTS = 7116; 145 146 public static final int MULTIPLE_CURSORS_NOT_SUPPORTED = 7117; 148 public static final int WRONG_USAGE_OF_SET_CUSTOM_SQL_ARGUMENT_TYPE_METOD = 7118; 149 public static final int CANNOT_TRANSLATE_UNPREPARED_CALL = 7119; 150 public static final int CANNOT_SET_CURSOR_FOR_PARAMETER_TYPE_OTHER_THAN_OUT = 7120; 151 public static final int PLATFORM_DOES_NOT_SUPPORT_STORED_FUNCTIONS = 7121; 152 public static final int EXCLUSIVE_CONNECTION_NO_LONGER_AVAILABLE = 7122; 153 154 public static final int UNIT_OF_WORK_IN_TRANSACTION_COMMIT_PENDING = 7123; 156 public static final int UNIT_OF_WORK_AFTER_WRITE_CHANGES_FAILED = 7124; 157 public static final int INACTIVE_UNIT_OF_WORK = 7125; 158 public static final int CANNOT_WRITE_CHANGES_ON_NESTED_UNIT_OF_WORK = 7126; 159 public static final int CANNOT_WRITE_CHANGES_TWICE = 7127; 160 public static final int ALREADY_LOGGED_IN = 7128; 161 162 public static final int INVALID_NULL_METHOD_ARGUMENTS = 7129; 164 public static final int NESTED_UOW_NOT_SUPPORTED_FOR_ATTRIBUTE_TRACKING = 7130; 165 public static final int WRONG_COLLECTION_CHANGE_EVENT_TYPE = 7131; 166 public static final int WRONG_CHANGE_EVENT = 7132; 167 public static final int OLD_COMMIT_NOT_SUPPORTED_FOR_ATTRIBUTE_TRACKING = 7133; 168 169 public static final int SERVER_PLATFORM_IS_READ_ONLY_AFTER_LOGIN = 7134; 171 public static final int CANNOT_COMMIT_AND_RESUME_UOW_WITH_MODIFY_ALL_QUERIES = 7135; 172 public static final int NESTED_UOW_NOT_SUPPORTED_FOR_MODIFY_ALL_QUERY = 7136; 173 174 public final static int UNFETCHED_ATTRIBUTE_NOT_EDITABLE = 7137; 176 public final static int OBJECT_NEED_IMPL_TRACKER_FOR_FETCH_GROUP_USAGE = 7138; 177 public static final int MODIFY_ALL_QUERIES_NOT_SUPPORTED_WITH_OTHER_WRITES = 7139; 178 179 public static final int WRONG_SEQUENCE_TYPE = 7140; 181 public static final int CANNOT_SET_DEFAULT_SEQUENCE_AS_DEFAULT = 7141; 182 public static final int DEFAULT_SEQUENCE_NAME_ALREADY_USED_BY_SEQUENCE = 7142; 183 public static final int SEQUENCE_NAME_ALREADY_USED_BY_DEFAULT_SEQUENCE = 7143; 184 public static final int PLATFORM_DOES_NOT_SUPPORT_SEQUENCE = 7144; 185 public static final int SEQUENCE_CANNOT_BE_CONNECTED_TO_TWO_PLATFORMS = 7145; 186 public static final int QUERY_SEQUENCE_DOES_NOT_HAVE_SELECT_QUERY = 7146; 187 public static final int CREATE_PLATFORM_DEFAULT_SEQUENCE_UNDEFINED = 7147; 188 public static final int CANNOT_RESUME_SYNCHRONIZED_UOW = 7148; 189 190 public static final int INVALID_COMPOSITE_PK_ATTRIBUTE = 7149; 192 public static final int INVALID_COMPOSITE_PK_SPECIFICATION = 7150; 193 public static final int INVALID_TYPE_FOR_ENUMERATED_ATTRIBUTE = 7151; 194 public static final int TABLE_PER_CLASS_INHERITANCE_NOT_SUPPORTED = 7152; 195 public static final int MAPPING_ANNOTATIONS_APPLIED_TO_TRANSIENT_ATTRIBUTE = 7153; 196 public static final int NO_MAPPED_BY_ATTRIBUTE_FOUND = 7154; 197 public static final int INVALID_TYPE_FOR_SERIALIZED_ATTRIBUTE = 7155; 198 public static final int UNABLE_TO_LOAD_CLASS = 7156; 199 public static final int INVALID_COLUMN_ANNOTATION_ON_RELATIONSHIP = 7157; 200 public static final int ERROR_PROCESSING_NAMED_QUERY_ANNOTATION = 7158; 201 public static final int COULD_NOT_FIND_MAP_KEY = 7159; 202 public static final int UNI_DIRECTIONAL_ONE_TO_MANY_HAS_JOINCOLUMN_ANNOTATIONS = 7160; 203 public static final int NO_PK_ANNOTATIONS_FOUND = 7161; 204 public static final int MULTIPLE_EMBEDDED_ID_ANNOTATIONS_FOUND = 7162; 205 public static final int EMBEDDED_ID_AND_ID_ANNOTATIONS_FOUND = 7163; 206 public static final int INVALID_TYPE_FOR_LOB_ATTRIBUTE = 7164; 207 public static final int INVALID_TYPE_FOR_TEMPORAL_ATTRIBUTE = 7165; 208 public static final int TABLE_GENERATOR_RESERVED_NAME = 7166; 209 public static final int SEQUENCE_GENERATOR_RESERVED_NAME = 7167; 210 public static final int INVALID_TYPE_FOR_VERSION_ATTRIBUTE = 7168; 211 public static final int ONLY_ONE_GENERATED_VALURE_IS_ALLOWED = 7169; 212 public static final int ERROR_INSTANTIATING_ENTITY_LISTENER = 7172; 213 214 public static final int WRONG_PROPERTY_NAME_IN_CHANGE_EVENT = 7173; 216 217 public static final int NO_CORRESPONDING_SETTER_METHOD_DEFINED = 7174; 219 220 public static final int UNSUPPORTED_CASCADE_LOCKING_MAPPING = 7175; 222 public static final int UNSUPPORTED_CASCADE_LOCKING_MAPPING_WITH_CUSTOM_QUERY = 7176; 223 public static final int UNSUPPORTED_CASCADE_LOCKING_DESCRIPTOR = 7177; 224 225 public static final int ORACLEOCIPROXYCONNECTOR_REQUIRES_ORACLEOCICONNECTIONPOOL = 7178; 227 public static final int ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_ORACLECONNECTION = 7179; 228 public static final int ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_ORACLECONNECTION_VERSION = 7180; 229 public static final int ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_INT_PROXYTYPE = 7181; 230 231 public static final int COULD_NOT_FIND_DRIVER_CLASS = 7182; 233 public static final int ERROR_CLOSING_PERSISTENCE_XML = 7183; 234 public static final int CONFIG_FACTORY_NAME_PROPERTY_NOT_SPECIFIED = 7184; 235 public static final int CONFIG_FACTORY_NAME_PROPERTY_NOT_FOUND = 7185; 236 public static final int CANNOT_INVOKE_METHOD_ON_CONFIG_CLASS = 7186; 237 public static final int CONFIG_METHOD_NOT_DEFINED = 7187; 238 public static final int CLASS_LIST_MUST_NOT_BE_NULL = 7188; 239 public static final int CURRENT_LOADER_NOT_VALID = 7189; 240 public static final int METHOD_FAILED = 7190; 241 public static final int ENTITY_CLASS_NOT_FOUND = 7191; 242 public static final int CLASS_FILE_TRANSFORMER_THROWS_EXCEPTION = 7192; 243 public static final int JAR_FILES_IN_PERSISTENCE_XML_NOT_SUPPORTED = 7193; 244 public static final int COULD_NOT_BIND_JNDI = 7194; 245 public static final int EXCEPTION_CONFIGURING_EM_FACTORY = 7195; 246 public static final int CANNOT_CAST_TO_CLASS = 7196; 247 public static final int NOT_SUPPORTED = 7197; 248 public static final int CLASS_NOT_FOUND_WHILE_CONVERTING_CLASSNAMES = 7198; 249 public static final int PRIMARY_TABLE_NOT_DEFINED_FOR_RELATIONSHIP = 7199; 250 public static final int INVALID_EMBEDDABLE_ATTRIBUTE = 7200; 251 public static final int INVALID_ENTITY_MAPPINGS_DOCUMENT = 7201; 252 public static final int INVALID_ATTRIBUTE_OVERRIDE_NAME = 7202; 253 public static final int INVALID_COLLECTION_TYPE_FOR_RELATIONSHIP = 7203; 254 public static final int MULTIPLE_EMBEDDED_ID_ELEMENTS_FOUND = 7205; 255 public static final int EMBEDDED_ID_AND_ID_ELEMENTS_FOUND = 7206; 256 public static final int INVALID_CLASS_TYPE_FOR_BLOB_ATTRIBUTE = 7207; 257 public static final int INVALID_CLASS_TYPE_FOR_CLOB_ATTRIBUTE = 7208; 258 public static final int UNI_DIRECTIONAL_ONE_TO_MANY_HAS_JOINCOLUMN_ELEMENTS = 7209; 259 public static final int ERROR_PROCESSING_NAMED_QUERY_ELEMENT = 7210; 260 public static final int INVALID_COLUMN_ELEMENT_ON_RELATIONSHIP = 7211; 261 public static final int TARGET_ENTITY_CANNOT_BE_DETERMINED = 7212; 262 public static final int NO_TEMPORAL_TYPE_SPECIFIED = 7214; 263 public static final int UNABLE_TO_DETERMINE_CLASS_FOR_FIELD = 7215; 264 public static final int UNABLE_TO_DETERMINE_CLASS_FOR_PROPERTY = 7216; 265 public static final int INVALID_ORDER_BY_VALUE = 7217; 266 public static final int PLATFORM_DOES_NOT_OVERRIDE_GETCREATETEMPTABLESQLPREFIX = 7218; 267 public static final int MAPPING_DOES_NOT_OVERRIDE_VALUEFROMROWINTERNALWITHJOIN = 7219; 268 269 public static final int INCOMPLETE_JOIN_COLUMNS_SPECIFIED = 7220; 271 public static final int EXCESSIVE_JOIN_COLUMNS_SPECIFIED = 7221; 272 public static final int INCOMPLETE_PRIMARY_KEY_JOIN_COLUMNS_SPECIFIED = 7222; 273 public static final int EXCESSIVE_PRIMARY_KEY_JOIN_COLUMNS_SPECIFIED = 7223; 274 275 public static final int INVALID_CALLBACK_METHOD = 7224; 277 public static final int INVALID_CALLBACK_METHOD_NAME = 7225; 278 public static final int INVALID_CALLBACK_METHOD_MODIFIER = 7226; 279 public static final int MULTIPLE_CALLBACK_METHODS_DEFINED = 7227; 280 public static final int INVALID_ENTITY_CALLBACK_METHOD_ARGUMENTS = 7228; 281 public static final int INVALID_ENTITY_LISTENER_CALLBACK_METHOD_ARGUMENTS = 7229; 282 283 public static final int PERSISTENCE_UNIT_METADATA_CONFLICT = 7230; 284 public static final int CANNOT_PERSIST_MANAGED_OBJECT = 7231; 285 public static final int UNSPECIFIED_COMPOSITE_PK_NOT_SUPPORTED = 7232; 286 287 public static final int INCOMPLETE_JOIN_COLUMN_ELEMENTS_SPECIFIED = 7233; 288 public static final int EXCESSIVE_JOIN_COLUMN_ELEMENTS_SPECIFIED = 7234; 289 public static final int INCOMPLETE_PK_JOIN_COLUMN_ELEMENTS_SPECIFIED = 7235; 290 public static final int EXCESSIVE_PK_JOIN_COLUMN_ELEMENTS_SPECIFIED = 7236; 291 292 public static final int NON_UNIQUE_ENTITY_NAME = 7237; 293 294 public static final int CONFLICTING_SEQUENCE_AND_TABLE_GENERATORS_SPECIFIED = 7238; 295 public static final int CONFLICTING_SEQUENCE_GENERATORS_SPECIFIED = 7239; 296 public static final int CONFLICTING_SEQUENCE_NAME_AND_TABLE_PK_COLUMN_VALUE_SPECIFIED = 7240; 297 public static final int CONFLICTING_TABLE_GENERATORS_SPECIFIED = 7241; 298 public static final int INSTANTIATING_VALUEHOLDER_WITH_NULL_SESSION = 7242; 299 300 public static final int CLASS_NOT_LISTED_IN_PERSISTENCE_UNIT = 7243; 301 302 public static final int INVALID_MAPPING = 7244; 303 public static final int CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE = 7245; 304 public static final int INVALID_EMBEDDED_ATTRIBUTE = 7246; 305 public static final int BOTH_FIELDS_AND_PROPERTIES_ANNOTATED = 7247; 306 public static final int INCORRECT_OVERRIDING_OF_ACCESSTYPE = 7248; 307 308 312 public ValidationException() { 313 super(); 314 } 315 316 320 protected ValidationException(String theMessage) { 321 super(theMessage); 322 } 323 324 328 protected ValidationException(String message, Exception internalException) { 329 super(message, internalException); 330 } 331 332 public static ValidationException alreadyLoggedIn(String sessionName) { 333 Object [] args = { sessionName }; 334 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ALREADY_LOGGED_IN, args)); 335 validationException.setErrorCode(ALREADY_LOGGED_IN); 336 return validationException; 337 } 338 339 public static ValidationException cannotAcquireClientSessionFromSession() { 340 Object [] args = { }; 341 342 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_ACQUIRE_CLIENTSESSION_FROM_SESSION, args)); 343 validationException.setErrorCode(CANNOT_ACQUIRE_CLIENTSESSION_FROM_SESSION); 344 return validationException; 345 } 346 347 public static ValidationException cannotAcquireDataSource(Object name, Exception exception) { 348 Object [] args = { name }; 349 350 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_ACQUIRE_DATA_SOURCE, args), exception); 351 validationException.setErrorCode(CANNOT_ACQUIRE_DATA_SOURCE); 352 return validationException; 353 } 354 355 public static ValidationException cannotAcquireHistoricalSession() { 357 Object [] args = { }; 358 359 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_ACQUIRE_HISTORICAL_SESSION, args)); 360 validationException.setErrorCode(CANNOT_ACQUIRE_HISTORICAL_SESSION); 361 return validationException; 362 } 363 364 public static ValidationException cannotAddDescriptorsToSessionBroker() { 365 Object [] args = { }; 366 367 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_ADD_DESCRIPTORS_TO_SESSION_BROKER, args)); 368 validationException.setErrorCode(CANNOT_ADD_DESCRIPTORS_TO_SESSION_BROKER); 369 return validationException; 370 } 371 372 public static ValidationException cannotCastToClass(Object ob, Class objectClass, Class castClass) { 373 Object [] args = { ob, objectClass, castClass }; 374 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_CAST_TO_CLASS, args)); 375 validationException.setErrorCode(CANNOT_CAST_TO_CLASS); 376 return validationException; 377 } 378 379 public static ValidationException cannotCommitAndResumeSynchronizedUOW(UnitOfWorkImpl uow) { 380 Object [] args = { }; 381 382 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_RESUME_SYNCHRONIZED_UOW, args)); 383 validationException.setErrorCode(CANNOT_RESUME_SYNCHRONIZED_UOW); 384 validationException.setSession(uow); 385 return validationException; 386 } 387 388 public static ValidationException cannotCommitAndResumeUOWWithModifyAllQueries() { 389 Object [] args = { }; 390 391 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_COMMIT_AND_RESUME_UOW_WITH_MODIFY_ALL_QUERIES, args)); 392 validationException.setErrorCode(CANNOT_COMMIT_AND_RESUME_UOW_WITH_MODIFY_ALL_QUERIES); 393 return validationException; 394 } 395 396 public static ValidationException cannotCommitUOWAgain() { 397 Object [] args = { }; 398 399 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_COMMIT_UOW_AGAIN, args)); 400 validationException.setErrorCode(CANNOT_COMMIT_UOW_AGAIN); 401 return validationException; 402 } 403 404 public static ValidationException cannotCreateExternalTransactionController(String externalTransactionControllerName) { 405 Object [] args = { externalTransactionControllerName }; 406 407 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_CREATE_EXTERNAL_TRANSACTION_CONTROLLER, args)); 408 validationException.setErrorCode(CANNOT_CREATE_EXTERNAL_TRANSACTION_CONTROLLER); 409 return validationException; 410 } 411 412 public static ValidationException notSupportedForDatasource() { 413 Object [] args = { }; 414 415 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NOT_SUPPORTED_FOR_DATASOURCE, args)); 416 validationException.setErrorCode(NOT_SUPPORTED_FOR_DATASOURCE); 417 return validationException; 418 } 419 420 public static ValidationException notSupported(String operation, Class theClass) { 421 Object [] args = { operation, theClass }; 422 423 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NOT_SUPPORTED, args)); 424 validationException.setErrorCode(NOT_SUPPORTED); 425 return validationException; 426 } 427 428 public static ValidationException cannotSetListenerClasses(Exception exception) { 429 Object [] args = { }; 430 431 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SET_LISTENER_CLASSES_EXCEPTION, args), exception); 432 validationException.setErrorCode(SET_LISTENER_CLASSES_EXCEPTION); 433 return validationException; 434 } 435 436 public static ValidationException cannotHaveUnboundInOutputArguments() { 437 Object [] args = { }; 438 439 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANT_HAVE_UNBOUND_IN_OUTPUT_ARGUMENTS, args)); 440 validationException.setErrorCode(CANT_HAVE_UNBOUND_IN_OUTPUT_ARGUMENTS); 441 return validationException; 442 } 443 444 public static ValidationException cannotModifyReadOnlyClassesSetAfterUsingUnitOfWork() { 445 Object [] args = { CR }; 446 447 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_MODIFY_READ_ONLY_CLASSES_SET_AFTER_USING_UNIT_OF_WORK, args)); 448 validationException.setErrorCode(CANNOT_MODIFY_READ_ONLY_CLASSES_SET_AFTER_USING_UNIT_OF_WORK); 449 return validationException; 450 } 451 452 public static ValidationException cannotRegisterAggregateObjectInUnitOfWork(Class type) { 453 Object [] args = { type }; 454 455 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_REGISTER_AGGREGATE_OBJECT_IN_UNIT_OF_WORK, args)); 456 validationException.setErrorCode(CANNOT_REGISTER_AGGREGATE_OBJECT_IN_UNIT_OF_WORK); 457 return validationException; 458 } 459 460 public static ValidationException cannotReleaseNonClientSession() { 461 Object [] args = { }; 462 463 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_RELEASE_NON_CLIENTSESSION, args)); 464 validationException.setErrorCode(CANNOT_RELEASE_NON_CLIENTSESSION); 465 return validationException; 466 } 467 468 public static ValidationException cannotRemoveFromReadOnlyClassesInNestedUnitOfWork() { 469 Object [] args = { CR }; 470 471 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_REMOVE_FROM_READ_ONLY_CLASSES_IN_NESTED_UNIT_OF_WORK, args)); 472 validationException.setErrorCode(CANNOT_REMOVE_FROM_READ_ONLY_CLASSES_IN_NESTED_UNIT_OF_WORK); 473 return validationException; 474 } 475 476 public static ValidationException cannotSetReadPoolSizeAfterLogin() { 477 Object [] args = { }; 478 479 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_SET_READ_POOL_SIZE_AFTER_LOGIN, args)); 480 validationException.setErrorCode(CANNOT_SET_READ_POOL_SIZE_AFTER_LOGIN); 481 return validationException; 482 } 483 484 public static ValidationException childDescriptorsDoNotHaveIdentityMap() { 485 Object [] args = { }; 486 487 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CHILD_DESCRIPTORS_DO_NOT_HAVE_IDENTITY_MAP, args)); 488 validationException.setErrorCode(CHILD_DESCRIPTORS_DO_NOT_HAVE_IDENTITY_MAP); 489 return validationException; 490 } 491 492 public static ValidationException clientSessionCanNotUseExclusiveConnection() { 493 Object [] args = { }; 494 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CLIENT_SESSION_CANNOT_USE_EXCLUSIVE_CONNECTION, args)); 495 validationException.setErrorCode(CLIENT_SESSION_CANNOT_USE_EXCLUSIVE_CONNECTION); 496 return validationException; 497 } 498 499 public static ValidationException containerPolicyDoesNotUseKeys(ContainerPolicy aPolicy, String methodName) { 500 Object [] args = { aPolicy.getContainerClass().toString(), methodName }; 501 502 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONTAINER_POLICY_DOES_NOT_USE_KEYS, args)); 503 validationException.setErrorCode(CONTAINER_POLICY_DOES_NOT_USE_KEYS); 504 return validationException; 505 } 506 507 public static ValidationException descriptorMustBeNotInitialized(ClassDescriptor descriptor) { 508 Object [] args = { descriptor, CR }; 509 510 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, DESCRIPTOR_MUST_NOT_BE_INITIALIZED, args)); 511 validationException.setErrorCode(DESCRIPTOR_MUST_NOT_BE_INITIALIZED); 512 return validationException; 513 } 514 515 516 public static ValidationException nonUniqueEntityName(String clsName1, String clsName2, String name) { 517 Object [] args = { name, clsName1, clsName2, CR }; 518 519 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NON_UNIQUE_ENTITY_NAME, args)); 520 validationException.setErrorCode(NON_UNIQUE_ENTITY_NAME); 521 return validationException; 522 } 523 524 public static ValidationException ejbCannotLoadRemoteClass(Exception exception, Class beanClass, String remoteClass) { 525 Object [] args = { beanClass, remoteClass, CR }; 526 527 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_CANNOT_LOAD_REMOTE_CLASS, args), exception); 528 validationException.setErrorCode(EJB_CANNOT_LOAD_REMOTE_CLASS); 529 return validationException; 530 } 531 532 public static ValidationException ejbContainerExceptionRaised(Exception exception) { 533 Object [] args = { }; 534 535 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_CONTAINER_EXCEPTION_RAISED, args), exception); 536 validationException.setErrorCode(EJB_CONTAINER_EXCEPTION_RAISED); 537 return validationException; 538 } 539 540 545 public static ValidationException ejbDescriptorNotFoundInSession(Class beanClass, String sessionName) { 546 Object [] args = { beanClass.getName(), sessionName }; 547 548 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_DESCRIPTOR_NOT_FOUND_IN_SESSION, args)); 549 validationException.setErrorCode(EJB_DESCRIPTOR_NOT_FOUND_IN_SESSION); 550 return validationException; 551 } 552 553 public static ValidationException ejbFinderException(Object bean, Throwable finderException, Vector primaryKey) { 554 Object [] args = { bean, bean.getClass(), primaryKey }; 555 556 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_FINDER_EXCEPTION, args)); 557 validationException.setErrorCode(EJB_FINDER_EXCEPTION); 558 return validationException; 559 } 560 561 public static ValidationException ejbInvalidHomeInterfaceClass(Class homeClassName) { 562 Object [] args = { homeClassName.toString() }; 563 564 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_INVALID_FINDER_ON_HOME, args)); 565 validationException.setErrorCode(EJB_INVALID_FINDER_ON_HOME); 566 return validationException; 567 } 568 569 public static ValidationException ejbInvalidPlatformClass(String platformName, String projectName) { 570 Object [] args = { platformName, projectName }; 571 572 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_INVALID_PLATFORM_CLASS, args)); 573 validationException.setErrorCode(EJB_INVALID_PLATFORM_CLASS); 574 return validationException; 575 } 576 577 582 public static ValidationException ejbInvalidProjectClass(String projectClassName, String projectName, Throwable aThrowable) { 583 Object [] args = { projectClassName, projectName }; 584 585 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_INVALID_PROJECT_CLASS, args)); 586 validationException.setInternalException(aThrowable); 587 validationException.setErrorCode(EJB_INVALID_PROJECT_CLASS); 588 return validationException; 589 } 590 591 596 public static ValidationException ejbInvalidSessionTypeClass(String sessionType, String sessionName) { 597 Object [] args = { sessionType, sessionName }; 598 599 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_INVALID_SESSION_TYPE_CLASS, args)); 600 validationException.setErrorCode(EJB_INVALID_SESSION_TYPE_CLASS); 601 return validationException; 602 } 603 604 609 public static ValidationException ejbMustBeInTransaction(Object bean) { 610 Object [] args = { bean, CR }; 611 612 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_MUST_BE_IN_TRANSACTION, args)); 613 validationException.setErrorCode(EJB_MUST_BE_IN_TRANSACTION); 614 return validationException; 615 } 616 617 622 public static ValidationException ejbNoSuchSessionSpecifiedInProperties(String sessionName, Class beanClass) { 623 Object [] args = { sessionName, beanClass }; 624 625 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_NO_SUCH_SESSION_SPECIFIED_IN_PROPERTIES, args)); 626 validationException.setErrorCode(EJB_NO_SUCH_SESSION_SPECIFIED_IN_PROPERTIES); 627 return validationException; 628 } 629 630 635 public static ValidationException ejbPrimaryKeyReflectionException(Exception exception, Object primaryKey, Object bean) { 636 Object [] args = { primaryKey, bean, CR }; 637 638 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_PRIMARY_KEY_REFLECTION_EXCEPTION, args), exception); 639 validationException.setErrorCode(EJB_PRIMARY_KEY_REFLECTION_EXCEPTION); 640 return validationException; 641 } 642 643 648 public static ValidationException ejbSessionTypeClassNotFound(String sessionType, String sessionName, Throwable exception) { 649 Object [] args = { sessionType, sessionName }; 650 651 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_SESSION_TYPE_CLASS_NOT_FOUND, args)); 652 validationException.setErrorCode(EJB_SESSION_TYPE_CLASS_NOT_FOUND); 653 validationException.setInternalException(exception); 654 return validationException; 655 } 656 657 662 public static ValidationException ejbTopLinkPropertiesNotFound(Exception exception) { 663 Object [] args = { }; 664 665 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EJB_TOPLINK_PROPERTIES_NOT_FOUND, args)); 666 validationException.setInternalException(exception); 667 validationException.setErrorCode(EJB_TOPLINK_PROPERTIES_NOT_FOUND); 668 return validationException; 669 } 670 671 public static ValidationException errorProcessingNamedQueryAnnotation(Class entityClass, String namedQuery, Exception exception) { 672 Object [] args = { entityClass, namedQuery }; 673 674 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ERROR_PROCESSING_NAMED_QUERY_ANNOTATION, args), exception); 675 validationException.setErrorCode(ERROR_PROCESSING_NAMED_QUERY_ANNOTATION); 676 return validationException; 677 } 678 679 public static ValidationException errorProcessingNamedQueryElement(String namedQuery, Exception exception) { 680 Object [] args = { namedQuery }; 681 682 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ERROR_PROCESSING_NAMED_QUERY_ELEMENT, args), exception); 683 validationException.setErrorCode(ERROR_PROCESSING_NAMED_QUERY_ELEMENT); 684 return validationException; 685 } 686 687 691 public static ValidationException errorInSessionsXML(String translatedExceptions) { 692 ValidationException validationException = new ValidationException(translatedExceptions); 693 validationException.setErrorCode(ERROR_IN_SESSION_XML); 694 return validationException; 695 } 696 697 public static ValidationException errorInstantiatingEntityListener(Class entityListener, Exception exception) { 698 Object [] args = { entityListener }; 699 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ERROR_INSTANTIATING_ENTITY_LISTENER, args), exception); 700 validationException.setErrorCode(ERROR_INSTANTIATING_ENTITY_LISTENER); 701 return validationException; 702 } 703 704 public static ValidationException noPropertiesFileFound(Exception exception) { 705 Object [] args = { }; 706 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_PROPERTIES_FILE_FOUND, args), exception); 707 validationException.setErrorCode(NO_PROPERTIES_FILE_FOUND); 708 return validationException; 709 } 710 711 public static ValidationException noSessionsXMLFound(String resourceName) { 712 Object [] args = { resourceName }; 713 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_SESSIONS_XML_FOUND, args)); 714 validationException.setErrorCode(NO_SESSIONS_XML_FOUND); 715 return validationException; 716 } 717 718 public static ValidationException errorEncryptingPassword(Exception exception) { 719 Object [] args = { }; 720 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ERROR_ENCRYPTING_PASSWORD, args), exception); 721 validationException.setErrorCode(ERROR_ENCRYPTING_PASSWORD); 722 return validationException; 723 } 724 725 public static ValidationException embeddedIdAndIdAnnotationFound(Class entityClass, String embeddedIdAttributeName, String idAttributeName) { 726 Object [] args = { entityClass, embeddedIdAttributeName, idAttributeName }; 727 728 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EMBEDDED_ID_AND_ID_ANNOTATIONS_FOUND, args)); 729 validationException.setErrorCode(EMBEDDED_ID_AND_ID_ANNOTATIONS_FOUND); 730 return validationException; 731 } 732 733 public static ValidationException embeddedIdAndIdElementFound(Class entityClass, String embeddedIdAttributeName, String idAttributeName) { 734 Object [] args = { entityClass, embeddedIdAttributeName, idAttributeName }; 735 736 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EMBEDDED_ID_AND_ID_ELEMENTS_FOUND, args)); 737 validationException.setErrorCode(EMBEDDED_ID_AND_ID_ELEMENTS_FOUND); 738 return validationException; 739 } 740 741 public static ValidationException errorDecryptingPassword(Exception exception) { 742 Object [] args = { }; 743 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ERROR_DECRYPTING_PASSWORD, args), exception); 744 validationException.setErrorCode(ERROR_DECRYPTING_PASSWORD); 745 return validationException; 746 } 747 748 public static ValidationException invalidEncryptionClass(String className, Throwable throwableError) { 749 Object [] args = { className }; 750 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_ENCRYPTION_CLASS, args)); 751 validationException.setErrorCode(INVALID_ENCRYPTION_CLASS); 752 validationException.setInternalException(throwableError); 753 return validationException; 754 } 755 756 public static ValidationException invalidEntityCallbackMethodArguments(Class entityClass, String methodName) { 757 Object [] args = { entityClass, methodName }; 758 759 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_ENTITY_CALLBACK_METHOD_ARGUMENTS, args)); 760 validationException.setErrorCode(INVALID_ENTITY_CALLBACK_METHOD_ARGUMENTS); 761 return validationException; 762 } 763 764 public static ValidationException invalidEntityListenerCallbackMethodArguments(Class entityClass, Class parameterClass, Class entityListener, String methodName) { 765 Object [] args = { entityClass, parameterClass, entityListener, methodName }; 766 767 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_ENTITY_LISTENER_CALLBACK_METHOD_ARGUMENTS, args)); 768 validationException.setErrorCode(INVALID_ENTITY_LISTENER_CALLBACK_METHOD_ARGUMENTS); 769 return validationException; 770 } 771 772 public static ValidationException noTopLinkEjbJarXMLFound() { 773 Object [] args = { }; 774 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_TOPLINK_EJB_JAR_XML_FOUND, args)); 775 validationException.setErrorCode(NO_TOPLINK_EJB_JAR_XML_FOUND); 776 return validationException; 777 } 778 779 public static ValidationException excusiveConnectionIsNoLongerAvailable(DatabaseQuery query, AbstractSession session) { 780 Object [] args = { query.getReferenceClass().getName() }; 781 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXCLUSIVE_CONNECTION_NO_LONGER_AVAILABLE, args)); 782 validationException.setErrorCode(EXCLUSIVE_CONNECTION_NO_LONGER_AVAILABLE); 783 validationException.setSession(session); 784 return validationException; 785 } 786 787 public static ValidationException existingQueryTypeConflict(DatabaseQuery newQuery, DatabaseQuery existingQuery) { 788 Object [] args = { newQuery, newQuery.getName(), newQuery.getArgumentTypes(), existingQuery, existingQuery.getName(), existingQuery.getArgumentTypes() }; 789 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXISTING_QUERY_TYPE_CONFLICT, args)); 790 validationException.setErrorCode(EXISTING_QUERY_TYPE_CONFLICT); 791 return validationException; 792 } 793 794 public static ValidationException fatalErrorOccurred(Exception exception) { 795 Object [] args = { }; 796 797 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, FATAL_ERROR_OCCURRED, args), exception); 798 validationException.setErrorCode(FATAL_ERROR_OCCURRED); 799 return validationException; 800 } 801 802 public static ValidationException featureIsNotAvailableInRunningJDKVersion(String feature) { 803 Object [] args = { feature, System.getProperty("java.version") }; 804 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, FEATURE_NOT_SUPPORTED_IN_JDK_VERSION, args)); 805 validationException.setErrorCode(FEATURE_NOT_SUPPORTED_IN_JDK_VERSION); 806 return validationException; 807 } 808 809 public static ValidationException fieldLevelLockingNotSupportedWithoutUnitOfWork() { 810 Object [] args = { }; 811 812 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, FIELD_LEVEL_LOCKING_NOTSUPPORTED_OUTSIDE_A_UNIT_OF_WORK, args)); 813 validationException.setErrorCode(FIELD_LEVEL_LOCKING_NOTSUPPORTED_OUTSIDE_A_UNIT_OF_WORK); 814 return validationException; 815 } 816 817 822 public static ValidationException invalidOrderByValue(String referenceAttribute, Class referenceClass, String entityAttribute, Class entityClass) { 823 Object [] args = { referenceAttribute, referenceClass, entityAttribute, entityClass }; 824 825 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_ORDER_BY_VALUE, args)); 826 validationException.setErrorCode(INVALID_ORDER_BY_VALUE); 827 return validationException; 828 } 829 830 public static ValidationException fileError(java.io.IOException exception) { 831 Object [] args = { }; 832 833 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, FILE_ERROR, args), exception); 834 validationException.setErrorCode(FILE_ERROR); 835 return validationException; 836 } 837 838 public static ValidationException illegalContainerClass(Class aClass) { 839 Object [] args = { aClass.toString() }; 840 841 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ILLEGAL_CONTAINER_CLASS, args)); 842 validationException.setErrorCode(ILLEGAL_CONTAINER_CLASS); 843 return validationException; 844 } 845 846 public static ValidationException illegalUseOfMapInDirectCollection(oracle.toplink.essentials.mappings.DirectCollectionMapping directCollectionMapping, Class aMapClass, String keyMethodName) { 847 Object [] args = { directCollectionMapping, keyMethodName }; 848 849 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ILLEGAL_USE_OF_MAP_IN_DIRECTCOLLECTION, args)); 850 validationException.setErrorCode(ILLEGAL_USE_OF_MAP_IN_DIRECTCOLLECTION); 851 return validationException; 852 } 853 854 public static ValidationException incorrectLoginInstanceProvided() { 855 Object [] args = { }; 856 857 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INCORRECT_LOGIN_INSTANCE_PROVIDED, args)); 858 validationException.setErrorCode(INCORRECT_LOGIN_INSTANCE_PROVIDED); 859 return validationException; 860 } 861 862 public static ValidationException instantiatingValueholderWithNullSession() { 863 Object [] args = { }; 864 865 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INSTANTIATING_VALUEHOLDER_WITH_NULL_SESSION, args)); 866 validationException.setErrorCode(INSTANTIATING_VALUEHOLDER_WITH_NULL_SESSION); 867 return validationException; 868 } 869 870 877 public static ValidationException invalidAttributeOverrideName(String columnName, Class embeddableClass) { 878 Object [] args = { columnName, embeddableClass }; 879 880 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_ATTRIBUTE_OVERRIDE_NAME, args)); 881 validationException.setErrorCode(INVALID_ATTRIBUTE_OVERRIDE_NAME); 882 return validationException; 883 } 884 885 public static ValidationException invalidCallbackMethod(Class listenerClass, String methodName) { 886 Object [] args = { listenerClass, methodName }; 887 888 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_CALLBACK_METHOD, args)); 889 validationException.setErrorCode(INVALID_CALLBACK_METHOD); 890 return validationException; 891 } 892 893 public static ValidationException invalidCallbackMethodModifier(Class listenerClass, String methodName) { 894 Object [] args = { listenerClass, methodName }; 895 896 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_CALLBACK_METHOD_MODIFIER, args)); 897 validationException.setErrorCode(INVALID_CALLBACK_METHOD_MODIFIER); 898 return validationException; 899 } 900 901 public static ValidationException invalidCallbackMethodName(Class listenerClass, String methodName) { 902 Object [] args = { listenerClass, methodName }; 903 904 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_CALLBACK_METHOD_NAME, args)); 905 validationException.setErrorCode(INVALID_CALLBACK_METHOD_NAME); 906 return validationException; 907 } 908 909 public static ValidationException invalidClassTypeForBLOBAttribute(Class entityClass, String attributeName) { 910 Object [] args = { entityClass, attributeName }; 911 912 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_CLASS_TYPE_FOR_BLOB_ATTRIBUTE, args)); 913 validationException.setErrorCode(INVALID_CLASS_TYPE_FOR_BLOB_ATTRIBUTE); 914 return validationException; 915 } 916 917 public static ValidationException invalidClassTypeForCLOBAttribute(Class entityClass, String attributeName) { 918 Object [] args = { entityClass, attributeName }; 919 920 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_CLASS_TYPE_FOR_CLOB_ATTRIBUTE, args)); 921 validationException.setErrorCode(INVALID_CLASS_TYPE_FOR_CLOB_ATTRIBUTE); 922 return validationException; 923 } 924 925 public static ValidationException invalidTypeForEnumeratedAttribute(String attributeName, Class targetClass, Class entityClass) { 926 Object [] args = { attributeName, targetClass, entityClass }; 927 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_TYPE_FOR_ENUMERATED_ATTRIBUTE, args)); 928 validationException.setErrorCode(INVALID_TYPE_FOR_ENUMERATED_ATTRIBUTE); 929 return validationException; 930 } 931 932 public static ValidationException invalidTypeForLOBAttribute(String attributeName, Class targetClass, Class entityClass) { 933 Object [] args = { attributeName, targetClass, entityClass }; 934 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_TYPE_FOR_LOB_ATTRIBUTE, args)); 935 validationException.setErrorCode(INVALID_TYPE_FOR_LOB_ATTRIBUTE); 936 return validationException; 937 } 938 939 public static ValidationException invalidTypeForSerializedAttribute(String attributeName, Class targetClass, Class entityClass) { 940 Object [] args = { attributeName, targetClass, entityClass }; 941 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_TYPE_FOR_SERIALIZED_ATTRIBUTE, args)); 942 validationException.setErrorCode(INVALID_TYPE_FOR_SERIALIZED_ATTRIBUTE); 943 return validationException; 944 } 945 946 public static ValidationException invalidTypeForTemporalAttribute(String attributeName, Class targetClass, Class entityClass) { 947 Object [] args = { attributeName, targetClass, entityClass }; 948 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_TYPE_FOR_TEMPORAL_ATTRIBUTE, args)); 949 validationException.setErrorCode(INVALID_TYPE_FOR_TEMPORAL_ATTRIBUTE); 950 return validationException; 951 } 952 953 public static ValidationException invalidTypeForVersionAttribute(String attributeName, Class lockingType, Class entityClass) { 954 Object [] args = { attributeName, lockingType, entityClass }; 955 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_TYPE_FOR_VERSION_ATTRIBUTE, args)); 956 validationException.setErrorCode(INVALID_TYPE_FOR_VERSION_ATTRIBUTE); 957 return validationException; 958 } 959 960 public static ValidationException invalidCollectionTypeForRelationship(Class rawClass, Object annotatedElement) { 961 Object [] args = { rawClass, annotatedElement }; 962 963 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_COLLECTION_TYPE_FOR_RELATIONSHIP, args)); 964 validationException.setErrorCode(INVALID_COLLECTION_TYPE_FOR_RELATIONSHIP); 965 return validationException; 966 } 967 968 public static ValidationException invalidColumnAnnotationOnRelationship(Class entityClass, String attributeName) { 969 Object [] args = { entityClass, attributeName }; 970 971 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_COLUMN_ANNOTATION_ON_RELATIONSHIP, args)); 972 validationException.setErrorCode(INVALID_COLUMN_ANNOTATION_ON_RELATIONSHIP); 973 return validationException; 974 } 975 976 public static ValidationException invalidColumnElementOnRelationship(Class entityClass, String attributeName) { 977 Object [] args = { entityClass, attributeName }; 978 979 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_COLUMN_ELEMENT_ON_RELATIONSHIP, args)); 980 validationException.setErrorCode(INVALID_COLUMN_ELEMENT_ON_RELATIONSHIP); 981 return validationException; 982 } 983 984 public static ValidationException invalidCompositePKAttribute(Class entityClass, String pkClassName, String attributeName, Type expectedType, Type actualType) { 985 Object [] args = { entityClass, pkClassName, attributeName, expectedType, actualType }; 986 987 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_COMPOSITE_PK_ATTRIBUTE, args)); 988 validationException.setErrorCode(INVALID_COMPOSITE_PK_ATTRIBUTE); 989 return validationException; 990 } 991 992 public static ValidationException invalidCompositePKSpecification(Class entityClass, String pkClassName) { 993 Object [] args = { entityClass, pkClassName }; 994 995 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_COMPOSITE_PK_SPECIFICATION, args)); 996 validationException.setErrorCode(INVALID_COMPOSITE_PK_SPECIFICATION); 997 return validationException; 998 } 999 1000 public static ValidationException invalidConnector(oracle.toplink.essentials.sessions.Connector connector) { 1001 Object [] args = { connector }; 1002 1003 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_CONNECTOR, args)); 1004 validationException.setErrorCode(INVALID_CONNECTOR); 1005 return validationException; 1006 } 1007 1008 public static ValidationException invalidDataSourceName(String name, Exception exception) { 1009 Object [] args = { name }; 1010 1011 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_DATA_SOURCE_NAME, args), exception); 1012 validationException.setErrorCode(INVALID_DATA_SOURCE_NAME); 1013 return validationException; 1014 } 1015 1016 public static ValidationException invalidEmbeddableAttribute(Class aggregateClass, String aggregateAttributeName, Class owningClass, String owningAttributeName) { 1017 Object [] args = { aggregateClass, aggregateAttributeName, owningClass, owningAttributeName}; 1018 1019 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_EMBEDDABLE_ATTRIBUTE, args)); 1020 validationException.setErrorCode(INVALID_EMBEDDABLE_ATTRIBUTE); 1021 return validationException; 1022 } 1023 1024 1029 public static ValidationException invalidEntityMappingsDocument(String fileName, Exception exception) { 1030 Object [] args = { fileName }; 1031 1032 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_ENTITY_MAPPINGS_DOCUMENT, args), exception); 1033 validationException.setErrorCode(INVALID_ENTITY_MAPPINGS_DOCUMENT); 1034 return validationException; 1035 } 1036 1037 public static ValidationException invalidFileName(String fileName) { 1038 Object [] args = { fileName }; 1039 1040 ValidationException exception = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_FILE_TYPE, args)); 1041 exception.setErrorCode(INVALID_FILE_TYPE); 1042 return exception; 1043 } 1044 1045 public static ValidationException invalidMergePolicy() { 1046 Object [] args = { }; 1047 1048 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_MERGE_POLICY, args)); 1049 validationException.setErrorCode(INVALID_MERGE_POLICY); 1050 return validationException; 1051 } 1052 1053 public static ValidationException javaTypeIsNotAValidDatabaseType(Class javaClass) { 1054 Object [] args = { javaClass }; 1055 1056 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, JAVA_TYPE_IS_NOT_A_VALID_DATABASE_TYPE, args)); 1057 validationException.setErrorCode(JAVA_TYPE_IS_NOT_A_VALID_DATABASE_TYPE); 1058 return validationException; 1059 } 1060 1061 public static ValidationException jtsExceptionRaised(Exception exception) { 1062 Object [] args = { }; 1063 1064 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, JTS_EXCEPTION_RAISED, args), exception); 1065 validationException.setErrorCode(JTS_EXCEPTION_RAISED); 1066 return validationException; 1067 } 1068 1069 public static ValidationException loginBeforeAllocatingClientSessions() { 1070 Object [] args = { }; 1071 1072 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, LOGIN_BEFORE_ALLOCATING_CLIENT_SESSIONS, args)); 1073 validationException.setErrorCode(LOGIN_BEFORE_ALLOCATING_CLIENT_SESSIONS); 1074 return validationException; 1075 } 1076 1077 public static ValidationException logIOError(java.io.IOException exception) { 1078 Object [] args = { }; 1079 1080 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, LOG_IO_ERROR, args), exception); 1081 validationException.setErrorCode(LOG_IO_ERROR); 1082 return validationException; 1083 } 1084 1085 public static ValidationException mapKeyNotDeclaredInItemClass(String keyName, Class aClass) { 1086 Object [] args = { keyName, aClass }; 1087 1088 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MAP_KEY_NOT_DECLARED_IN_ITEM_CLASS, args)); 1089 validationException.setErrorCode(MAP_KEY_NOT_DECLARED_IN_ITEM_CLASS); 1090 return validationException; 1091 } 1092 1093 public static ValidationException maxSizeLessThanMinSize() { 1094 Object [] args = { }; 1095 1096 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MAX_SIZE_LESS_THAN_MIN_SIZE, args)); 1097 validationException.setErrorCode(MAX_SIZE_LESS_THAN_MIN_SIZE); 1098 return validationException; 1099 } 1100 1101 public static ValidationException noMappedByAttributeFound(Class ownerClass, String mappedByAttributeName, Class entityClass, String attributeName) { 1102 Object [] args = { ownerClass, mappedByAttributeName, entityClass, attributeName }; 1103 1104 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_MAPPED_BY_ATTRIBUTE_FOUND, args)); 1105 validationException.setErrorCode(NO_MAPPED_BY_ATTRIBUTE_FOUND); 1106 return validationException; 1107 } 1108 1109 public static ValidationException noPrimaryKeyAnnotationsFound(Class entityClass) { 1110 Object [] args = { entityClass }; 1111 1112 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_PK_ANNOTATIONS_FOUND, args)); 1113 validationException.setErrorCode(NO_PK_ANNOTATIONS_FOUND); 1114 return validationException; 1115 } 1116 1117 1122 public static ValidationException noProjectSpecifiedInProperties(String bundleName, String serverName) { 1123 Object [] args = { bundleName, serverName }; 1124 1125 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_PROJECT_SPECIFIED_IN_PROPERTIES, args)); 1126 validationException.setErrorCode(NO_PROJECT_SPECIFIED_IN_PROPERTIES); 1127 return validationException; 1128 } 1129 1130 public static ValidationException noSessionFound(String sessionName, String resourceName) { 1131 Object [] args = { sessionName, resourceName }; 1132 1133 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_SESSION_FOUND, args)); 1134 validationException.setErrorCode(NO_SESSION_FOUND); 1135 return validationException; 1136 } 1137 1138 public static ValidationException noSessionRegisteredForClass(Class domainClass) { 1139 Object [] args = { domainClass }; 1140 1141 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_SESSION_REGISTERED_FOR_CLASS, args)); 1142 validationException.setErrorCode(NO_SESSION_REGISTERED_FOR_CLASS); 1143 return validationException; 1144 } 1145 1146 public static ValidationException noSessionRegisteredForName(String sessionName) { 1147 Object [] args = { sessionName }; 1148 1149 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_SESSION_REGISTERED_FOR_NAME, args)); 1150 validationException.setErrorCode(NO_SESSION_REGISTERED_FOR_NAME); 1151 return validationException; 1152 } 1153 1154 public static ValidationException noTablesToCreate(oracle.toplink.essentials.sessions.Project project) { 1155 Object [] args = { project }; 1156 1157 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_TABLES_TO_CREATE, args)); 1158 validationException.setErrorCode(NO_TABLES_TO_CREATE); 1159 return validationException; 1160 } 1161 1162 public static ValidationException noTemporalTypeSpecified(String attributeName, Class entityClass) { 1163 Object [] args = { attributeName, entityClass }; 1164 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_TEMPORAL_TYPE_SPECIFIED, args)); 1165 validationException.setErrorCode(NO_TEMPORAL_TYPE_SPECIFIED); 1166 return validationException; 1167 } 1168 1169 public static ValidationException uniDirectionalOneToManyHasJoinColumnAnnotations(Class entityClass, String attributeName) { 1170 Object [] args = { entityClass, attributeName }; 1171 1172 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNI_DIRECTIONAL_ONE_TO_MANY_HAS_JOINCOLUMN_ANNOTATIONS, args)); 1173 validationException.setErrorCode(UNI_DIRECTIONAL_ONE_TO_MANY_HAS_JOINCOLUMN_ANNOTATIONS); 1174 return validationException; 1175 } 1176 1177 public static ValidationException uniDirectionalOneToManyHasJoinColumnElements(Class entityClass, String attributeName) { 1178 Object [] args = { entityClass, attributeName }; 1179 1180 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNI_DIRECTIONAL_ONE_TO_MANY_HAS_JOINCOLUMN_ELEMENTS, args)); 1181 validationException.setErrorCode(UNI_DIRECTIONAL_ONE_TO_MANY_HAS_JOINCOLUMN_ELEMENTS); 1182 return validationException; 1183 } 1184 1185 public static ValidationException onlyFieldsAreValidKeysForDatabaseRows() { 1186 Object [] args = { }; 1187 1188 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ONLY_FIELDS_ARE_VALID_KEYS_FOR_DATABASE_ROWS, args)); 1189 validationException.setErrorCode(ONLY_FIELDS_ARE_VALID_KEYS_FOR_DATABASE_ROWS); 1190 return validationException; 1191 } 1192 1193 public static ValidationException operationNotSupported(String methodName) { 1194 Object [] args = { methodName }; 1195 1196 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, OPERATION_NOT_SUPPORTED, args)); 1197 validationException.setErrorCode(OPERATION_NOT_SUPPORTED); 1198 return validationException; 1199 } 1200 1201 public static ValidationException optimisticLockingNotSupportedWithStoredProcedureGeneration() { 1202 Object [] args = { }; 1203 1204 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, OPTIMISTIC_LOCKING_NOT_SUPPORTED, args)); 1205 validationException.setErrorCode(OPTIMISTIC_LOCKING_NOT_SUPPORTED); 1206 return validationException; 1207 } 1208 1209 public static ValidationException oracleObjectTypeIsNotDefined(String typeName) { 1210 Object [] args = { typeName }; 1211 1212 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLE_OBJECT_TYPE_NOT_DEFINED, args)); 1213 validationException.setErrorCode(ORACLE_OBJECT_TYPE_NOT_DEFINED); 1214 return validationException; 1215 } 1216 1217 public static ValidationException oracleObjectTypeNameIsNotDefined(Class type) { 1218 Object [] args = { type }; 1219 1220 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLE_OBJECT_TYPE_NAME_NOT_DEFINED, args)); 1221 validationException.setErrorCode(ORACLE_OBJECT_TYPE_NAME_NOT_DEFINED); 1222 return validationException; 1223 } 1224 1225 public static ValidationException oracleVarrayMaximumSizeNotDefined(String typeName) { 1226 Object [] args = { typeName }; 1227 1228 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLE_VARRAY_MAXIMIM_SIZE_NOT_DEFINED, args)); 1229 validationException.setErrorCode(ORACLE_VARRAY_MAXIMIM_SIZE_NOT_DEFINED); 1230 return validationException; 1231 } 1232 1233 public static ValidationException persistenceUnitMetadataConflict(String tagName) { 1234 Object [] args = { tagName }; 1235 1236 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PERSISTENCE_UNIT_METADATA_CONFLICT, args)); 1237 validationException.setErrorCode(PERSISTENCE_UNIT_METADATA_CONFLICT); 1238 return validationException; 1239 } 1240 1241 public static ValidationException platformClassNotFound(Exception exception, String className) { 1242 Object [] args = { className }; 1243 1244 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PLATFORM_CLASS_NOT_FOUND, args), exception); 1245 validationException.setErrorCode(PLATFORM_CLASS_NOT_FOUND); 1246 return validationException; 1247 } 1248 1249 public static ValidationException poolNameDoesNotExist(String poolName) { 1250 Object [] args = { poolName }; 1251 1252 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, POOL_NAME_DOES_NOT_EXIST, args)); 1253 validationException.setErrorCode(POOL_NAME_DOES_NOT_EXIST); 1254 return validationException; 1255 } 1256 1257 public static ValidationException poolsMustBeConfiguredBeforeLogin() { 1258 Object [] args = { }; 1259 1260 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, POOLS_MUST_BE_CONFIGURED_BEFORE_LOGIN, args)); 1261 validationException.setErrorCode(POOLS_MUST_BE_CONFIGURED_BEFORE_LOGIN); 1262 return validationException; 1263 } 1264 1265 1271 public static ValidationException primaryTableNotDefined(Class javaClass, String instanceDocName) { 1272 Object [] args = { javaClass, instanceDocName }; 1273 1274 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PRIMARY_TABLE_NOT_DEFINED_FOR_RELATIONSHIP, args)); 1275 validationException.setErrorCode(PRIMARY_TABLE_NOT_DEFINED_FOR_RELATIONSHIP); 1276 return validationException; 1277 } 1278 1279 1284 public static ValidationException projectAmendmentExceptionOccured(Exception exception, String amendmentMethod, String amendmentClass) { 1285 Object [] args = { amendmentMethod, amendmentClass }; 1286 1287 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PROJECT_AMENDMENT_EXCEPTION_OCCURED, args)); 1288 validationException.setInternalException(exception); 1289 validationException.setErrorCode(PROJECT_AMENDMENT_EXCEPTION_OCCURED); 1290 return validationException; 1291 } 1292 1293 public static ValidationException projectXMLNotFound(String projectXMLFile, Exception exception) { 1294 Object [] args = { projectXMLFile }; 1295 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PROJECT_XML_NOT_FOUND, args)); 1296 validationException.setInternalException(exception); 1297 validationException.setErrorCode(PROJECT_XML_NOT_FOUND); 1298 return validationException; 1299 } 1300 1301 public static ValidationException queryArgumentTypeNotFound(DatabaseQuery query, String argumentName, String typeAsString, Exception exception) { 1302 Object [] args = { query.getName(), argumentName, typeAsString }; 1303 1304 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, QUERY_ARGUMENT_TYPE_NOT_FOUND, args)); 1305 validationException.setInternalException(exception); 1306 validationException.setErrorCode(QUERY_ARGUMENT_TYPE_NOT_FOUND); 1307 return validationException; 1308 } 1309 1310 public static ValidationException sequenceSetupIncorrectly(String sequenceName) { 1311 Object [] args = { sequenceName }; 1312 1313 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SEQUENCE_SETUP_INCORRECTLY, args)); 1314 validationException.setErrorCode(SEQUENCE_SETUP_INCORRECTLY); 1315 return validationException; 1316 } 1317 1318 1323 public static ValidationException serverPlatformIsReadOnlyAfterLogin(String serverPlatformClassName) { 1324 Object [] args = { serverPlatformClassName }; 1325 1326 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SERVER_PLATFORM_IS_READ_ONLY_AFTER_LOGIN, args)); 1327 validationException.setErrorCode(SERVER_PLATFORM_IS_READ_ONLY_AFTER_LOGIN); 1328 return validationException; 1329 } 1330 1331 1336 public static ValidationException sessionAmendmentExceptionOccured(Exception exception, String amendmentMethod, String amendmentClass, Class [] parameters) { 1337 StringBuffer buf = new StringBuffer (30); 1338 for (int i = 0; i < (parameters.length - 1); i++) { 1339 buf.append(parameters[i].getName()); 1340 if (i != (parameters.length - 1)) { 1341 buf.append(", "); 1342 } 1343 } 1344 buf.append(parameters[parameters.length - 1].getName()); 1345 1346 Object [] args = { amendmentClass, amendmentMethod, buf.toString() }; 1347 1348 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SESSION_AMENDMENT_EXCEPTION_OCCURED, args)); 1349 validationException.setInternalException(exception); 1350 validationException.setErrorCode(SESSION_AMENDMENT_EXCEPTION_OCCURED); 1351 return validationException; 1352 } 1353 1354 public static ValidationException startIndexOutOfRange() { 1355 Object [] args = { }; 1356 1357 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, START_INDEX_OUT_OF_RANGE, args)); 1358 validationException.setErrorCode(START_INDEX_OUT_OF_RANGE); 1359 return validationException; 1360 } 1361 1362 public static ValidationException stopIndexOutOfRange() { 1363 Object [] args = { }; 1364 1365 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, STOP_INDEX_OUT_OF_RANGE, args)); 1366 validationException.setErrorCode(STOP_INDEX_OUT_OF_RANGE); 1367 return validationException; 1368 } 1369 1370 1375 public static ValidationException subSessionsNotDefinedForBroker(String brokerName) { 1376 Object [] args = { brokerName }; 1377 1378 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SUB_SESSION_NOT_DEFINED_FOR_BROKER, args)); 1379 validationException.setErrorCode(SUB_SESSION_NOT_DEFINED_FOR_BROKER); 1380 return validationException; 1381 } 1382 1383 1388 public static ValidationException targetEntityCannotBeDetermined(Class attributeType, String attributeName, Class entityClass) { 1389 Object [] args = { attributeType, attributeName, entityClass }; 1390 1391 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, TARGET_ENTITY_CANNOT_BE_DETERMINED, args)); 1392 validationException.setErrorCode(TARGET_ENTITY_CANNOT_BE_DETERMINED); 1393 return validationException; 1394 } 1395 1396 public static ValidationException tablePerClassInheritanceNotSupported(Class entityClass) { 1397 Object [] args = { entityClass }; 1398 1399 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, TABLE_PER_CLASS_INHERITANCE_NOT_SUPPORTED, args)); 1400 validationException.setErrorCode(TABLE_PER_CLASS_INHERITANCE_NOT_SUPPORTED); 1401 return validationException; 1402 } 1403 1404 public static ValidationException writeObjectNotAllowedInUnitOfWork() { 1405 Object [] args = { }; 1406 1407 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRITE_OBJECT_NOT_ALLOWED_IN_UNIT_OF_WORK, args)); 1408 validationException.setErrorCode(WRITE_OBJECT_NOT_ALLOWED_IN_UNIT_OF_WORK); 1409 return validationException; 1410 } 1411 1412 public static ValidationException wrongObjectRegistered(Object registered, Object parent) { 1413 Object [] args = { registered, parent }; 1414 1415 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRONG_OBJECT_REGISTERED, args)); 1416 validationException.setErrorCode(WRONG_OBJECT_REGISTERED); 1417 return validationException; 1418 } 1419 1420 public static ValidationException cannotIssueModifyAllQueryWithOtherWritesWithinUOW() { 1421 Object [] args = { }; 1422 1423 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MODIFY_ALL_QUERIES_NOT_SUPPORTED_WITH_OTHER_WRITES, args)); 1424 validationException.setErrorCode(MODIFY_ALL_QUERIES_NOT_SUPPORTED_WITH_OTHER_WRITES); 1425 return validationException; 1426 } 1427 1428 public static ValidationException nullCacheKeyFoundOnRemoval(IdentityMap map, Class clazz) { 1429 Object [] args = { map, clazz, CR }; 1430 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NULL_CACHE_KEY_FOUND_ON_REMOVAL, args)); 1431 validationException.setErrorCode(NULL_CACHE_KEY_FOUND_ON_REMOVAL); 1432 return validationException; 1433 } 1434 1435 public static ValidationException nullUnderlyingValueHolderValue(String methodName) { 1436 Object [] args = { methodName, CR }; 1437 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NULL_UNDERLYING_VALUEHOLDER_VALUE, args)); 1438 validationException.setErrorCode(NULL_UNDERLYING_VALUEHOLDER_VALUE); 1439 return validationException; 1440 } 1441 1442 public static ValidationException invalidSequencingLogin() { 1443 Object [] args = { }; 1444 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_SEQUENCING_LOGIN, args)); 1445 validationException.setErrorCode(INVALID_SEQUENCING_LOGIN); 1446 return validationException; 1447 } 1448 1449 public static ValidationException isolatedDataNotSupportedInSessionBroker(String sessionName) { 1450 Object [] args = { sessionName }; 1451 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ISOLATED_DATA_NOT_SUPPORTED_IN_CLIENTSESSIONBROKER, args)); 1452 validationException.setErrorCode(ISOLATED_DATA_NOT_SUPPORTED_IN_CLIENTSESSIONBROKER); 1453 return validationException; 1454 } 1455 1456 public static ValidationException projectLoginIsNull(AbstractSession session) { 1457 Object [] args = { }; 1458 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PROJECT_LOGIN_IS_NULL, args)); 1459 validationException.setErrorCode(PROJECT_LOGIN_IS_NULL); 1460 return validationException; 1461 } 1462 1463 public static ValidationException historicalSessionOnlySupportedOnOracle() { 1464 Object [] args = { }; 1465 1466 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, HISTORICAL_SESSION_ONLY_SUPPORTED_ON_ORACLE, args)); 1467 validationException.setErrorCode(HISTORICAL_SESSION_ONLY_SUPPORTED_ON_ORACLE); 1468 return validationException; 1469 } 1470 1471 public static ValidationException platformDoesNotSupportCallWithReturning(String platformTypeName) { 1472 Object [] args = { platformTypeName }; 1473 1474 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PLATFORM_DOES_NOT_SUPPORT_CALL_WITH_RETURNING, args)); 1475 validationException.setErrorCode(PLATFORM_DOES_NOT_SUPPORT_CALL_WITH_RETURNING); 1476 return validationException; 1477 } 1478 1479 public static ValidationException invalidNullMethodArguments() { 1480 Object [] args = { }; 1481 1482 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_NULL_METHOD_ARGUMENTS, args)); 1483 validationException.setErrorCode(INVALID_NULL_METHOD_ARGUMENTS); 1484 return validationException; 1485 } 1486 1487 public static ValidationException invalidMethodArguments() { 1488 Object [] args = { }; 1489 1490 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_METHOD_ARGUMENTS, args)); 1491 validationException.setErrorCode(INVALID_METHOD_ARGUMENTS); 1492 return validationException; 1493 } 1494 1495 public static ValidationException wrongUsageOfSetCustomArgumentTypeMethod(String callString) { 1496 Object [] args = { callString }; 1497 1498 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRONG_USAGE_OF_SET_CUSTOM_SQL_ARGUMENT_TYPE_METOD, args)); 1499 validationException.setErrorCode(WRONG_USAGE_OF_SET_CUSTOM_SQL_ARGUMENT_TYPE_METOD); 1500 return validationException; 1501 } 1502 1503 public static ValidationException cannotTranslateUnpreparedCall(String callString) { 1504 Object [] args = { callString }; 1505 1506 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_TRANSLATE_UNPREPARED_CALL, args)); 1507 validationException.setErrorCode(CANNOT_TRANSLATE_UNPREPARED_CALL); 1508 return validationException; 1509 } 1510 1511 public static ValidationException cannotSetCursorForParameterTypeOtherThanOut(String fieldName, String callString) { 1512 Object [] args = { fieldName, callString }; 1513 1514 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_SET_CURSOR_FOR_PARAMETER_TYPE_OTHER_THAN_OUT, args)); 1515 validationException.setErrorCode(CANNOT_SET_CURSOR_FOR_PARAMETER_TYPE_OTHER_THAN_OUT); 1516 return validationException; 1517 } 1518 1519 public static ValidationException platformDoesNotSupportStoredFunctions(String platformTypeName) { 1520 Object [] args = { platformTypeName }; 1521 1522 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PLATFORM_DOES_NOT_SUPPORT_STORED_FUNCTIONS, args)); 1523 validationException.setErrorCode(PLATFORM_DOES_NOT_SUPPORT_STORED_FUNCTIONS); 1524 return validationException; 1525 } 1526 1527 public static ValidationException illegalOperationForUnitOfWorkLifecycle(int lifecycle, String operation) { 1528 switch (lifecycle) { 1529 case UnitOfWorkImpl.CommitTransactionPending: 1530 return unitOfWorkInTransactionCommitPending(operation); 1531 case UnitOfWorkImpl.WriteChangesFailed: 1532 return unitOfWorkAfterWriteChangesFailed(operation); 1533 case UnitOfWorkImpl.Death:default: 1534 return inActiveUnitOfWork(operation); 1535 } 1536 } 1537 1538 public static ValidationException unitOfWorkInTransactionCommitPending(String operation) { 1539 Object [] args = { operation }; 1540 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNIT_OF_WORK_IN_TRANSACTION_COMMIT_PENDING, args)); 1541 validationException.setErrorCode(UNIT_OF_WORK_IN_TRANSACTION_COMMIT_PENDING); 1542 return validationException; 1543 } 1544 1545 public static ValidationException unspecifiedCompositePKNotSupported(Class entityClass) { 1546 Object [] args = { entityClass }; 1547 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNSPECIFIED_COMPOSITE_PK_NOT_SUPPORTED, args)); 1548 validationException.setErrorCode(UNSPECIFIED_COMPOSITE_PK_NOT_SUPPORTED); 1549 return validationException; 1550 } 1551 1552 public static ValidationException unsupportedCascadeLockingDescriptor(ClassDescriptor descriptor) { 1553 Object [] args = { descriptor }; 1554 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNSUPPORTED_CASCADE_LOCKING_DESCRIPTOR, args)); 1555 validationException.setErrorCode(UNSUPPORTED_CASCADE_LOCKING_DESCRIPTOR); 1556 return validationException; 1557 } 1558 1559 public static ValidationException unsupportedCascadeLockingMapping(DatabaseMapping mapping) { 1560 Object [] args = { mapping }; 1561 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNSUPPORTED_CASCADE_LOCKING_MAPPING, args)); 1562 validationException.setErrorCode(UNSUPPORTED_CASCADE_LOCKING_MAPPING); 1563 return validationException; 1564 } 1565 1566 public static ValidationException unsupportedCascadeLockingMappingWithCustomQuery(DatabaseMapping mapping) { 1567 Object [] args = { mapping }; 1568 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNSUPPORTED_CASCADE_LOCKING_MAPPING_WITH_CUSTOM_QUERY, args)); 1569 validationException.setErrorCode(UNSUPPORTED_CASCADE_LOCKING_MAPPING_WITH_CUSTOM_QUERY); 1570 return validationException; 1571 } 1572 1573 public static ValidationException unitOfWorkAfterWriteChangesFailed(String operation) { 1574 Object [] args = { operation }; 1575 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNIT_OF_WORK_AFTER_WRITE_CHANGES_FAILED, args)); 1576 validationException.setErrorCode(UNIT_OF_WORK_AFTER_WRITE_CHANGES_FAILED); 1577 return validationException; 1578 } 1579 1580 public static ValidationException inActiveUnitOfWork(String operation) { 1581 Object [] args = { operation }; 1582 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INACTIVE_UNIT_OF_WORK, args)); 1583 validationException.setErrorCode(INACTIVE_UNIT_OF_WORK); 1584 return validationException; 1585 } 1586 1587 public static ValidationException incompleteJoinColumnsSpecified(Object annotatedElement, Class javaClass) { 1588 Object [] args = { annotatedElement, javaClass }; 1589 1590 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INCOMPLETE_JOIN_COLUMNS_SPECIFIED, args)); 1591 validationException.setErrorCode(INCOMPLETE_JOIN_COLUMNS_SPECIFIED); 1592 return validationException; 1593 } 1594 1595 public static ValidationException incompleteJoinColumnElementsSpecified(Object attributeName, Class javaClass) { 1596 Object [] args = { attributeName, javaClass }; 1597 1598 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INCOMPLETE_JOIN_COLUMN_ELEMENTS_SPECIFIED, args)); 1599 validationException.setErrorCode(INCOMPLETE_JOIN_COLUMN_ELEMENTS_SPECIFIED); 1600 return validationException; 1601 } 1602 1603 public static ValidationException incompletePrimaryKeyJoinColumnElementsSpecified(Object annotatedElement) { 1604 Object [] args = { annotatedElement }; 1605 1606 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INCOMPLETE_PK_JOIN_COLUMN_ELEMENTS_SPECIFIED, args)); 1607 validationException.setErrorCode(INCOMPLETE_PK_JOIN_COLUMN_ELEMENTS_SPECIFIED); 1608 return validationException; 1609 } 1610 1611 public static ValidationException incompletePrimaryKeyJoinColumnsSpecified(Object annotatedElement) { 1612 Object [] args = { annotatedElement }; 1613 1614 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INCOMPLETE_PRIMARY_KEY_JOIN_COLUMNS_SPECIFIED, args)); 1615 validationException.setErrorCode(INCOMPLETE_PRIMARY_KEY_JOIN_COLUMNS_SPECIFIED); 1616 return validationException; 1617 } 1618 1619 public static ValidationException unitOfWorkInTransactionCommitPending() { 1620 Object [] args = { }; 1621 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNIT_OF_WORK_IN_TRANSACTION_COMMIT_PENDING, args)); 1622 validationException.setErrorCode(UNIT_OF_WORK_IN_TRANSACTION_COMMIT_PENDING); 1623 return validationException; 1624 } 1625 1626 public static ValidationException writeChangesOnNestedUnitOfWork() { 1627 Object [] args = { }; 1628 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_WRITE_CHANGES_ON_NESTED_UNIT_OF_WORK, args)); 1629 validationException.setErrorCode(CANNOT_WRITE_CHANGES_ON_NESTED_UNIT_OF_WORK); 1630 return validationException; 1631 } 1632 1633 public static ValidationException cannotWriteChangesTwice() { 1634 Object [] args = { }; 1635 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_WRITE_CHANGES_TWICE, args)); 1636 validationException.setErrorCode(CANNOT_WRITE_CHANGES_TWICE); 1637 return validationException; 1638 } 1639 1640 public static ValidationException nestedUOWNotSupportedForAttributeTracking() { 1641 Object [] args = { }; 1642 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NESTED_UOW_NOT_SUPPORTED_FOR_ATTRIBUTE_TRACKING, args)); 1643 validationException.setErrorCode(NESTED_UOW_NOT_SUPPORTED_FOR_ATTRIBUTE_TRACKING); 1644 return validationException; 1645 } 1646 1647 public static ValidationException nestedUOWNotSupportedForModifyAllQuery() { 1648 Object [] args = { }; 1649 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NESTED_UOW_NOT_SUPPORTED_FOR_MODIFY_ALL_QUERY, args)); 1650 validationException.setErrorCode(NESTED_UOW_NOT_SUPPORTED_FOR_MODIFY_ALL_QUERY); 1651 return validationException; 1652 } 1653 1654 public static ValidationException noCorrespondingSetterMethodDefined(Class entityClass, Method method) { 1655 Object [] args = { entityClass, method }; 1656 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, NO_CORRESPONDING_SETTER_METHOD_DEFINED, args)); 1657 validationException.setErrorCode(NO_CORRESPONDING_SETTER_METHOD_DEFINED); 1658 return validationException; 1659 } 1660 1661 public static ValidationException wrongCollectionChangeEventType(int eveType) { 1662 Object [] args = { new Integer (eveType) }; 1663 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRONG_COLLECTION_CHANGE_EVENT_TYPE, args)); 1664 validationException.setErrorCode(WRONG_COLLECTION_CHANGE_EVENT_TYPE); 1665 return validationException; 1666 } 1667 1668 public static ValidationException wrongChangeEvent(Class eveClass) { 1669 Object [] args = { eveClass }; 1670 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRONG_CHANGE_EVENT, args)); 1671 validationException.setErrorCode(WRONG_CHANGE_EVENT); 1672 return validationException; 1673 } 1674 1675 public static ValidationException oldCommitNotSupportedForAttributeTracking() { 1676 Object [] args = { }; 1677 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, OLD_COMMIT_NOT_SUPPORTED_FOR_ATTRIBUTE_TRACKING, args)); 1678 validationException.setErrorCode(OLD_COMMIT_NOT_SUPPORTED_FOR_ATTRIBUTE_TRACKING); 1679 return validationException; 1680 } 1681 1682 1689 public static ValidationException unableToDetermineClassForField(String fieldName, Class entityClass) { 1690 Object [] args = { fieldName, entityClass }; 1691 1692 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNABLE_TO_DETERMINE_CLASS_FOR_FIELD, args)); 1693 validationException.setErrorCode(UNABLE_TO_DETERMINE_CLASS_FOR_FIELD); 1694 return validationException; 1695 } 1696 1697 1704 public static ValidationException unableToDetermineClassForProperty(String propertyName, Class entityClass) { 1705 Object [] args = { propertyName, entityClass }; 1706 1707 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNABLE_TO_DETERMINE_CLASS_FOR_PROPERTY, args)); 1708 validationException.setErrorCode(UNABLE_TO_DETERMINE_CLASS_FOR_PROPERTY); 1709 return validationException; 1710 } 1711 1712 public static ValidationException unableToLoadClass(String classname, Exception exception) { 1713 Object [] args = { classname }; 1714 1715 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNABLE_TO_LOAD_CLASS, args), exception); 1716 validationException.setErrorCode(UNABLE_TO_LOAD_CLASS); 1717 return validationException; 1718 } 1719 1720 public static ValidationException unfetchedAttributeNotEditable(String attributeName) { 1721 Object [] args = { attributeName }; 1722 1723 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, UNFETCHED_ATTRIBUTE_NOT_EDITABLE, args)); 1724 validationException.setErrorCode(UNFETCHED_ATTRIBUTE_NOT_EDITABLE); 1725 return validationException; 1726 } 1727 1728 public static ValidationException objectNeedImplTrackerForFetchGroupUsage(String className) { 1729 Object [] args = { className }; 1730 1731 QueryException queryException = new QueryException(ExceptionMessageGenerator.buildMessage(QueryException.class, OBJECT_NEED_IMPL_TRACKER_FOR_FETCH_GROUP_USAGE, args)); 1732 queryException.setErrorCode(OBJECT_NEED_IMPL_TRACKER_FOR_FETCH_GROUP_USAGE); 1733 return queryException; 1734 } 1735 1736 public static ValidationException wrongSequenceType(String typeName, String methodName) { 1737 Object [] args = { typeName, methodName }; 1738 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRONG_SEQUENCE_TYPE, args)); 1739 validationException.setErrorCode(WRONG_SEQUENCE_TYPE); 1740 return validationException; 1741 } 1742 1743 public static ValidationException cannotSetDefaultSequenceAsDefault(String seqName) { 1744 Object [] args = { seqName }; 1745 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_SET_DEFAULT_SEQUENCE_AS_DEFAULT, args)); 1746 validationException.setErrorCode(CANNOT_SET_DEFAULT_SEQUENCE_AS_DEFAULT); 1747 return validationException; 1748 } 1749 1750 public static ValidationException defaultSequenceNameAlreadyUsedBySequence(String seqName) { 1751 Object [] args = { seqName }; 1752 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, DEFAULT_SEQUENCE_NAME_ALREADY_USED_BY_SEQUENCE, args)); 1753 validationException.setErrorCode(DEFAULT_SEQUENCE_NAME_ALREADY_USED_BY_SEQUENCE); 1754 return validationException; 1755 } 1756 1757 public static ValidationException sequenceNameAlreadyUsedByDefaultSequence(String seqName) { 1758 Object [] args = { seqName }; 1759 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SEQUENCE_NAME_ALREADY_USED_BY_DEFAULT_SEQUENCE, args)); 1760 validationException.setErrorCode(SEQUENCE_NAME_ALREADY_USED_BY_DEFAULT_SEQUENCE); 1761 return validationException; 1762 } 1763 1764 public static ValidationException platformDoesNotSupportSequence(String seqName, String platformTypeName, String sequenceTypeName) { 1765 Object [] args = { seqName, platformTypeName, sequenceTypeName }; 1766 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PLATFORM_DOES_NOT_SUPPORT_SEQUENCE, args)); 1767 validationException.setErrorCode(PLATFORM_DOES_NOT_SUPPORT_SEQUENCE); 1768 return validationException; 1769 } 1770 1771 public static ValidationException sequenceCannotBeConnectedToTwoPlatforms(String seqName, String ownerPlatformName, String otherPlatformName) { 1772 Object [] args = { seqName, ownerPlatformName, otherPlatformName }; 1773 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SEQUENCE_CANNOT_BE_CONNECTED_TO_TWO_PLATFORMS, args)); 1774 validationException.setErrorCode(SEQUENCE_CANNOT_BE_CONNECTED_TO_TWO_PLATFORMS); 1775 return validationException; 1776 } 1777 1778 public static ValidationException querySequenceDoesNotHaveSelectQuery(String seqName) { 1779 Object [] args = { seqName }; 1780 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, QUERY_SEQUENCE_DOES_NOT_HAVE_SELECT_QUERY, args)); 1781 validationException.setErrorCode(QUERY_SEQUENCE_DOES_NOT_HAVE_SELECT_QUERY); 1782 return validationException; 1783 } 1784 1785 public static ValidationException createPlatformDefaultSequenceUndefined(String platformTypeName) { 1786 Object [] args = { platformTypeName }; 1787 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CREATE_PLATFORM_DEFAULT_SEQUENCE_UNDEFINED, args)); 1788 validationException.setErrorCode(CREATE_PLATFORM_DEFAULT_SEQUENCE_UNDEFINED); 1789 return validationException; 1790 } 1791 1792 public static ValidationException sequenceGeneratorUsingAReservedName(String reservedName, String location) { 1793 Object [] args = { reservedName, location }; 1794 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, SEQUENCE_GENERATOR_RESERVED_NAME, args)); 1795 validationException.setErrorCode(SEQUENCE_GENERATOR_RESERVED_NAME); 1796 return validationException; 1797 } 1798 1799 public static ValidationException tableGeneratorUsingAReservedName(String reservedName, String location) { 1800 Object [] args = { reservedName, location }; 1801 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, TABLE_GENERATOR_RESERVED_NAME, args)); 1802 validationException.setErrorCode(TABLE_GENERATOR_RESERVED_NAME); 1803 return validationException; 1804 } 1805 1806 public static ValidationException onlyOneGeneratedValueIsAllowed(Class cls, String field1, String field2) { 1807 Object [] args = { cls, field1, field2 }; 1808 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ONLY_ONE_GENERATED_VALURE_IS_ALLOWED, args)); 1809 validationException.setErrorCode(ONLY_ONE_GENERATED_VALURE_IS_ALLOWED); 1810 return validationException; 1811 } 1812 1813 public static ValidationException wrongPropertyNameInChangeEvent(Class objectClass, String propertyName) { 1814 Object [] args = { objectClass, propertyName }; 1815 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, WRONG_PROPERTY_NAME_IN_CHANGE_EVENT, args)); 1816 validationException.setErrorCode(WRONG_PROPERTY_NAME_IN_CHANGE_EVENT); 1817 return validationException; 1818 } 1819 1820 public static ValidationException oracleOCIProxyConnectorRequiresOracleOCIConnectionPool() { 1821 Object [] args = { }; 1822 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLEOCIPROXYCONNECTOR_REQUIRES_ORACLEOCICONNECTIONPOOL, args)); 1823 validationException.setErrorCode(ORACLEOCIPROXYCONNECTOR_REQUIRES_ORACLEOCICONNECTIONPOOL); 1824 return validationException; 1825 } 1826 1827 public static ValidationException oracleJDBC10_1_0_2ProxyConnectorRequiresOracleConnection() { 1828 Object [] args = { }; 1829 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_ORACLECONNECTION, args)); 1830 validationException.setErrorCode(ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_ORACLECONNECTION); 1831 return validationException; 1832 } 1833 1834 public static ValidationException oracleJDBC10_1_0_2ProxyConnectorRequiresOracleConnectionVersion() { 1835 Object [] args = { }; 1836 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_ORACLECONNECTION_VERSION, args)); 1837 validationException.setErrorCode(ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_ORACLECONNECTION_VERSION); 1838 return validationException; 1839 } 1840 1841 public static ValidationException oracleJDBC10_1_0_2ProxyConnectorRequiresIntProxytype() { 1842 Object [] args = { }; 1843 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_INT_PROXYTYPE, args)); 1844 validationException.setErrorCode(ORACLEJDBC10_1_0_2PROXYCONNECTOR_REQUIRES_INT_PROXYTYPE); 1845 return validationException; 1846 } 1847 1848 public static ValidationException couldNotFindDriverClass(Object driver, Exception ex) { 1849 Object [] args = { driver }; 1850 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, COULD_NOT_FIND_DRIVER_CLASS, args), ex); 1851 validationException.setErrorCode(COULD_NOT_FIND_DRIVER_CLASS); 1852 return validationException; 1853 } 1854 1855 public static ValidationException couldNotFindMapKey(String attributeName, Class entityClass, DatabaseMapping mapping) { 1856 Object [] args = { attributeName, entityClass, mapping }; 1857 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, COULD_NOT_FIND_MAP_KEY, args)); 1858 validationException.setErrorCode(COULD_NOT_FIND_MAP_KEY); 1859 return validationException; 1860 } 1861 1862 public static ValidationException errorClosingPersistenceXML(Exception ex) { 1863 Object [] args = { }; 1864 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ERROR_CLOSING_PERSISTENCE_XML, args), ex); 1865 validationException.setErrorCode(ERROR_CLOSING_PERSISTENCE_XML); 1866 return validationException; 1867 } 1868 1869 public static ValidationException configFactoryNamePropertyNotSpecified(String configFactory) { 1870 Object [] args = { configFactory }; 1871 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFIG_FACTORY_NAME_PROPERTY_NOT_SPECIFIED, args)); 1872 validationException.setErrorCode(CONFIG_FACTORY_NAME_PROPERTY_NOT_SPECIFIED); 1873 return validationException; 1874 } 1875 1876 public static ValidationException configFactoryNamePropertyNotFound(String configClass, String configFactory, Exception ex) { 1877 Object [] args = { configClass, configFactory }; 1878 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFIG_FACTORY_NAME_PROPERTY_NOT_FOUND, args), ex); 1879 validationException.setErrorCode(CONFIG_FACTORY_NAME_PROPERTY_NOT_FOUND); 1880 return validationException; 1881 } 1882 1883 public static ValidationException cannotInvokeMethodOnConfigClass(String configMethod, String configClass, String configFactory, Exception ex) { 1884 Object [] args = { configMethod, configClass, configFactory }; 1885 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_INVOKE_METHOD_ON_CONFIG_CLASS, args), ex); 1886 validationException.setErrorCode(CANNOT_INVOKE_METHOD_ON_CONFIG_CLASS); 1887 return validationException; 1888 } 1889 1890 public static ValidationException configMethodNotDefined(String configClass, String configMethod) { 1891 Object [] args = { configClass, configMethod }; 1892 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFIG_METHOD_NOT_DEFINED, args)); 1893 validationException.setErrorCode(CONFIG_METHOD_NOT_DEFINED); 1894 return validationException; 1895 } 1896 1897 public static ValidationException conflictingSequenceAndTableGeneratorsSpecified(String name, String sequenceGeneratorLocation, String tableGeneratorLocation) { 1898 Object [] args = { name, sequenceGeneratorLocation, tableGeneratorLocation }; 1899 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFLICTING_SEQUENCE_AND_TABLE_GENERATORS_SPECIFIED, args)); 1900 validationException.setErrorCode(CONFLICTING_SEQUENCE_AND_TABLE_GENERATORS_SPECIFIED); 1901 return validationException; 1902 } 1903 1904 public static ValidationException conflictingSequenceGeneratorsSpecified(String name, String location1, String location2) { 1905 Object [] args = { name, location1, location2 }; 1906 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFLICTING_SEQUENCE_GENERATORS_SPECIFIED, args)); 1907 validationException.setErrorCode(CONFLICTING_SEQUENCE_GENERATORS_SPECIFIED); 1908 return validationException; 1909 } 1910 1911 public static ValidationException conflictingSequenceNameAndTablePkColumnValueSpecified(String name, String sequenceGeneratorLocation, String tableGeneratorLocation) { 1912 Object [] args = { name, sequenceGeneratorLocation, tableGeneratorLocation }; 1913 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFLICTING_SEQUENCE_NAME_AND_TABLE_PK_COLUMN_VALUE_SPECIFIED, args)); 1914 validationException.setErrorCode(CONFLICTING_SEQUENCE_NAME_AND_TABLE_PK_COLUMN_VALUE_SPECIFIED); 1915 return validationException; 1916 } 1917 1918 public static ValidationException conflictingTableGeneratorsSpecified(String name, String location1, String location2) { 1919 Object [] args = { name, location1, location2 }; 1920 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CONFLICTING_TABLE_GENERATORS_SPECIFIED, args)); 1921 validationException.setErrorCode(CONFLICTING_TABLE_GENERATORS_SPECIFIED); 1922 return validationException; 1923 } 1924 1925 public static ValidationException classListMustNotBeNull() { 1926 Object [] args = { }; 1927 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CLASS_LIST_MUST_NOT_BE_NULL, args)); 1928 validationException.setErrorCode(CLASS_LIST_MUST_NOT_BE_NULL); 1929 return validationException; 1930 } 1931 1932 public static ValidationException currentLoaderNotValid(ClassLoader loader) { 1933 Object [] args = { loader }; 1934 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CURRENT_LOADER_NOT_VALID, args)); 1935 validationException.setErrorCode(CURRENT_LOADER_NOT_VALID); 1936 return validationException; 1937 } 1938 1939 public static ValidationException methodFailed(String methodName, Exception ex) { 1940 Object [] args = { methodName }; 1941 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, METHOD_FAILED, args), ex); 1942 validationException.setErrorCode(METHOD_FAILED); 1943 return validationException; 1944 } 1945 1946 public static ValidationException missingDescriptor(String className) { 1947 Object [] args = { className }; 1948 1949 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MISSING_DESCRIPTOR, args)); 1950 validationException.setErrorCode(MISSING_DESCRIPTOR); 1951 return validationException; 1952 } 1953 1954 1958 public static ValidationException missingMappingForAttribute(ClassDescriptor descriptor, String attributeName, String source) { 1959 Object [] args = { descriptor, attributeName, source }; 1960 1961 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MISSING_MAPPING, args)); 1962 validationException.setErrorCode(MISSING_MAPPING); 1963 return validationException; 1964 } 1965 1966 public static ValidationException multipleCursorsNotSupported(String callString) { 1967 Object [] args = { callString }; 1968 1969 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MULTIPLE_CURSORS_NOT_SUPPORTED, args)); 1970 validationException.setErrorCode(MULTIPLE_CURSORS_NOT_SUPPORTED); 1971 return validationException; 1972 } 1973 1974 public static ValidationException multipleEmbeddedIdAnnotationsFound(Class entityClass, String attributeName1, String attributeName2) { 1975 Object [] args = { entityClass, attributeName1, attributeName2 }; 1976 1977 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MULTIPLE_EMBEDDED_ID_ANNOTATIONS_FOUND, args)); 1978 validationException.setErrorCode(MULTIPLE_EMBEDDED_ID_ANNOTATIONS_FOUND); 1979 return validationException; 1980 } 1981 1982 public static ValidationException multipleEmbeddedIdElementsFound(Class entityClass, String attributeName1, String attributeName2) { 1983 Object [] args = { entityClass, attributeName1, attributeName2 }; 1984 1985 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MULTIPLE_EMBEDDED_ID_ELEMENTS_FOUND, args)); 1986 validationException.setErrorCode(MULTIPLE_EMBEDDED_ID_ELEMENTS_FOUND); 1987 return validationException; 1988 } 1989 1990 public static ValidationException multipleLifecycleCallbackMethodsForSameLifecycleEvent(Class listenerClass, Method method1, Method method2) { 1991 Object [] args = { listenerClass, method1, method2 }; 1992 1993 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MULTIPLE_CALLBACK_METHODS_DEFINED, args)); 1994 validationException.setErrorCode(MULTIPLE_CALLBACK_METHODS_DEFINED); 1995 return validationException; 1996 } 1997 1998 2003 public static ValidationException multipleProjectsSpecifiedInProperties(String bundleName, String serverName) { 2004 Object [] args = { bundleName, serverName }; 2005 2006 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MULTIPLE_PROJECTS_SPECIFIED_IN_PROPERTIES, args)); 2007 validationException.setErrorCode(MULTIPLE_PROJECTS_SPECIFIED_IN_PROPERTIES); 2008 return validationException; 2009 } 2010 2011 public static ValidationException entityClassNotFound(String entityClass, ClassLoader loader, Exception ex) { 2012 Object [] args = { entityClass, loader }; 2013 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, ENTITY_CLASS_NOT_FOUND, args), ex); 2014 validationException.setErrorCode(ENTITY_CLASS_NOT_FOUND); 2015 return validationException; 2016 } 2017 2018 public static ValidationException classFileTransformerThrowsException(Object transformer, String className, Exception ex) { 2019 Object [] args = { transformer, className }; 2020 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CLASS_FILE_TRANSFORMER_THROWS_EXCEPTION, args), ex); 2021 validationException.setErrorCode(CLASS_FILE_TRANSFORMER_THROWS_EXCEPTION); 2022 return validationException; 2023 } 2024 2025 public static ValidationException jarFilesInPersistenceXmlNotSupported() { 2026 Object [] args = { }; 2027 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, JAR_FILES_IN_PERSISTENCE_XML_NOT_SUPPORTED, args)); 2028 validationException.setErrorCode(JAR_FILES_IN_PERSISTENCE_XML_NOT_SUPPORTED); 2029 return validationException; 2030 } 2031 2032 public static ValidationException couldNotBindJndi(String bindName, Object bindValue, Exception ex) { 2033 Object [] args = { bindName, bindValue }; 2034 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, COULD_NOT_BIND_JNDI, args), ex); 2035 validationException.setErrorCode(COULD_NOT_BIND_JNDI); 2036 return validationException; 2037 } 2038 2039 public static ValidationException exceptionConfiguringEMFactory(Exception ex) { 2040 Object [] args = { }; 2041 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXCEPTION_CONFIGURING_EM_FACTORY, args), ex); 2042 validationException.setErrorCode(EXCEPTION_CONFIGURING_EM_FACTORY); 2043 return validationException; 2044 } 2045 2046 public static ValidationException excessiveJoinColumnElementsSpecified(String attributeName, Class javaClass) { 2047 Object [] args = { attributeName, javaClass }; 2048 2049 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXCESSIVE_JOIN_COLUMN_ELEMENTS_SPECIFIED, args)); 2050 validationException.setErrorCode(EXCESSIVE_JOIN_COLUMN_ELEMENTS_SPECIFIED); 2051 return validationException; 2052 } 2053 2054 public static ValidationException excessiveJoinColumnsSpecified(Object annotatedElement, Class javaClass) { 2055 Object [] args = { annotatedElement, javaClass }; 2056 2057 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXCESSIVE_JOIN_COLUMNS_SPECIFIED, args)); 2058 validationException.setErrorCode(EXCESSIVE_JOIN_COLUMNS_SPECIFIED); 2059 return validationException; 2060 } 2061 2062 public static ValidationException excessivePrimaryKeyJoinColumnElementsSpecified(Object annotatedElement) { 2063 Object [] args = { annotatedElement }; 2064 2065 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXCESSIVE_PK_JOIN_COLUMN_ELEMENTS_SPECIFIED, args)); 2066 validationException.setErrorCode(EXCESSIVE_PK_JOIN_COLUMN_ELEMENTS_SPECIFIED); 2067 return validationException; 2068 } 2069 2070 public static ValidationException excessivePrimaryKeyJoinColumnsSpecified(Object annotatedElement) { 2071 Object [] args = { annotatedElement }; 2072 2073 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, EXCESSIVE_PRIMARY_KEY_JOIN_COLUMNS_SPECIFIED, args)); 2074 validationException.setErrorCode(EXCESSIVE_PRIMARY_KEY_JOIN_COLUMNS_SPECIFIED); 2075 return validationException; 2076 } 2077 2078 public static ValidationException classNotFoundWhileConvertingClassNames(String className, Exception exception) { 2079 Object [] args = { className }; 2080 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CLASS_NOT_FOUND_WHILE_CONVERTING_CLASSNAMES, args), exception); 2081 validationException.setErrorCode(CLASS_NOT_FOUND_WHILE_CONVERTING_CLASSNAMES); 2082 return validationException; 2083 } 2084 2085 public static ValidationException platformDoesNotOverrideGetCreateTempTableSqlPrefix(String className) { 2086 Object [] args = { className }; 2087 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, PLATFORM_DOES_NOT_OVERRIDE_GETCREATETEMPTABLESQLPREFIX, args)); 2088 validationException.setErrorCode(PLATFORM_DOES_NOT_OVERRIDE_GETCREATETEMPTABLESQLPREFIX); 2089 return validationException; 2090 } 2091 2092 public static ValidationException mappingAnnotationsAppliedToTransientAttribute(Object annotatedElement) { 2093 Object [] args = { annotatedElement }; 2094 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MAPPING_ANNOTATIONS_APPLIED_TO_TRANSIENT_ATTRIBUTE, args)); 2095 validationException.setErrorCode(MAPPING_ANNOTATIONS_APPLIED_TO_TRANSIENT_ATTRIBUTE); 2096 return validationException; 2097 } 2098 2099 public static ValidationException mappingDoesNotOverrideValueFromRowInternalWithJoin(String className) { 2100 Object [] args = { className }; 2101 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, MAPPING_DOES_NOT_OVERRIDE_VALUEFROMROWINTERNALWITHJOIN, args)); 2102 validationException.setErrorCode(MAPPING_DOES_NOT_OVERRIDE_VALUEFROMROWINTERNALWITHJOIN); 2103 return validationException; 2104 } 2105 2106 public static ValidationException cannotPersistExistingObject(Object registeredObject, Session session) { 2107 Vector key = new Vector (); 2108 if (session != null) { 2109 key = session.keyFromObject(registeredObject); 2110 } 2111 Object [] args = { registeredObject, registeredObject.getClass().getName(), key, CR }; 2112 2113 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CANNOT_PERSIST_MANAGED_OBJECT, args)); 2114 validationException.setErrorCode(CANNOT_PERSIST_MANAGED_OBJECT); 2115 return validationException; 2116 } 2117 2118 public static ValidationException classNotListedInPersistenceUnit(String className) { 2119 Object [] args = { className }; 2120 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, CLASS_NOT_LISTED_IN_PERSISTENCE_UNIT, args)); 2121 validationException.setErrorCode(CLASS_NOT_LISTED_IN_PERSISTENCE_UNIT); 2122 return validationException; 2123 } 2124 2125 public static ValidationException invalidMapping(Class entityClass, Class targetClass) { 2126 Object [] args = { entityClass, targetClass }; 2127 ValidationException validationException = new ValidationException(ExceptionMessageGenerator.buildMessage(ValidationException.class, INVALID_MAPPING, args)); 2128 validationException.setErrorCode(INVALID_MAPPING); 2129 return validationException; 2130 } 2131 2132 public static ValidationException conflictingAccessTypeForEmbeddable( 2133 Class embeddableClass) { 2134 Object [] args = {embeddableClass }; 2135 ValidationException validationException = new ValidationException( 2136 ExceptionMessageGenerator.buildMessage( 2137 ValidationException.class, 2138 CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE, args)); 2139 validationException.setErrorCode(CONFLICTNG_ACCESS_TYPE_FOR_EMBEDDABLE); 2140 return validationException; 2141 } 2142 2143 public static ValidationException invalidEmbeddedAttribute( 2144 Class javaClass, String attributeName, Class embeddableClass) { 2145 Object [] args = {javaClass, attributeName, embeddableClass}; 2146 ValidationException validationException = new ValidationException( 2147 ExceptionMessageGenerator.buildMessage( 2148 ValidationException.class, 2149 INVALID_EMBEDDED_ATTRIBUTE, args)); 2150 validationException.setErrorCode(INVALID_EMBEDDED_ATTRIBUTE); 2151 return validationException; 2152 } 2153 2154 public static ValidationException bothFieldsAndPropertiesAnnotated(Class javaClass) { 2155 Object [] args = {javaClass}; 2156 ValidationException validationException = new ValidationException( 2157 ExceptionMessageGenerator.buildMessage( 2158 ValidationException.class, 2159 BOTH_FIELDS_AND_PROPERTIES_ANNOTATED, args)); 2160 validationException.setErrorCode(BOTH_FIELDS_AND_PROPERTIES_ANNOTATED); 2161 return validationException; 2162 } 2163 2164 public static ValidationException incorrectOverridingOfAccessType( 2165 Class javaClass, String xmlAccessType, String annotAccessType) { 2166 Object [] args = {javaClass, xmlAccessType, annotAccessType}; 2167 ValidationException validationException = new ValidationException( 2168 ExceptionMessageGenerator.buildMessage( 2169 ValidationException.class, 2170 INCORRECT_OVERRIDING_OF_ACCESSTYPE, args)); 2171 validationException.setErrorCode(INCORRECT_OVERRIDING_OF_ACCESSTYPE); 2172 return validationException; 2173 } 2174} 2175 | Popular Tags |