KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > exceptions > DescriptorException


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.exceptions;
23
24 import java.lang.reflect.*;
25 import oracle.toplink.essentials.mappings.*;
26 import oracle.toplink.essentials.descriptors.DescriptorEvent;
27 import oracle.toplink.essentials.internal.helper.*;
28 import oracle.toplink.essentials.exceptions.i18n.ExceptionMessageGenerator;
29 import oracle.toplink.essentials.internal.sessions.AbstractRecord;
30 import oracle.toplink.essentials.descriptors.ClassDescriptor;
31
32 /**
33  * <b>Purpose</b>: This exception is used for any problem that is detected with a descriptor or mapping.
34  */

35 public class DescriptorException extends ValidationException {
36     protected transient ClassDescriptor descriptor;
37     protected transient DatabaseMapping mapping;
38     public final static int ATTRIBUTE_AND_MAPPING_WITH_INDIRECTION_MISMATCH = 1;
39     public final static int ATTRIBUTE_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH = 2;
40     public final static int ATTRIBUTE_NAME_NOT_SPECIFIED = 6;
41     public final static int ATTRIBUTE_TYPE_NOT_VALID = 7;
42     public final static int CLASS_INDICATOR_FIELD_NOT_FOUND = 8;
43     public final static int DIRECT_FIELD_NAME_NOT_SET = 9;
44     public final static int FIELD_NAME_NOT_SET_IN_MAPPING = 10;
45     public final static int FOREIGN_KEYS_DEFINED_INCORRECTLY = 11;
46     public final static int IDENTITY_MAP_NOT_SPECIFIED = 12;
47     public final static int ILLEGAL_ACCESS_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR = 13;
48     public final static int ILLEGAL_ACCESS_WHILE_CLONING = 14;
49     public final static int ILLEGAL_ACCESS_WHILE_CONSTRUCTOR_INSTANTIATION = 15;
50     public final static int ILLEGAL_ACCESS_WHILE_EVENT_EXECUTION = 16;
51     public final static int ILLEGAL_ACCESS_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR = 17;
52     public final static int ILLEGAL_ACCESS_WHILE_INSTANTIATING_METHOD_BASED_PROXY = 18;
53     public final static int ILLEGAL_ACCESS_WHILE_INVOKING_ATTRIBUTE_METHOD = 19;
54     public final static int ILLEGAL_ACCESS_WHILE_INVOKING_FIELD_TO_METHOD = 20;
55     public final static int ILLEGAL_ACCESS_WHILE_INVOKING_ROW_EXTRACTION_METHOD = 21;
56     public final static int ILLEGAL_ACCESS_WHILE_METHOD_INSTANTIATION = 22;
57     public final static int ILLEGAL_ACCESS_WHILE_OBSOLETE_EVENT_EXECUTION = 23;
58     public final static int ILLEGAL_ACCESS_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR = 24;
59     public final static int ILLEGAL_ACCESS_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR = 25;
60     public final static int ILLEGAL_ARGUMENT_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR = 26;
61     public final static int ILLEGAL_ARGUMENT_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR = 27;
62     public final static int ILLEGAL_ARGUMENT_WHILE_INSTANTIATING_METHOD_BASED_PROXY = 28;
63     public final static int ILLEGAL_ARGUMENT_WHILE_INVOKING_ATTRIBUTE_METHOD = 29;
64     public final static int ILLEGAL_ARGUMENT_WHILE_INVOKING_FIELD_TO_METHOD = 30;
65     public final static int ILLEGAL_ARGUMENT_WHILE_OBSOLETE_EVENT_EXECUTION = 31;
66     public final static int ILLEGAL_ARGUMENT_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR = 32;
67     public final static int ILLEGAL_ARGUMENT_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR = 33;
68     public final static int INSTANTIATION_WHILE_CONSTRUCTOR_INSTANTIATION = 34;
69     public final static int INVALID_DATA_MODIFICATION_EVENT = 35;
70     public final static int INVALID_DATA_MODIFICATION_EVENT_CODE = 36;
71     public final static int INVALID_DESCRIPTOR_EVENT_CODE = 37;
72     public final static int INVALID_IDENTITY_MAP = 38;
73     public final static int JAVA_CLASS_NOT_SPECIFIED = 39;
74     public final static int DESCRIPTOR_FOR_INTERFACE_IS_MISSING = 40;
75     public final static int MAPPING_FOR_SEQUENCE_NUMBER_FIELD = 41;
76     public final static int MISSING_CLASS_FOR_INDICATOR_FIELD_VALUE = 43;
77     public final static int MISSING_CLASS_INDICATOR_FIELD = 44;
78     public final static int MISSING_MAPPING_FOR_FIELD = 45;
79     public final static int NO_MAPPING_FOR_PRIMARY_KEY = 46;
80     public final static int MULTIPLE_TABLE_PRIMARY_KEY_NOT_SPECIFIED = 47;
81     public final static int MULTIPLE_WRITE_MAPPINGS_FOR_FIELD = 48;
82     public final static int NO_ATTRIBUTE_TRANSFORMATION_METHOD = 49;
83     public final static int NO_FIELD_NAME_FOR_MAPPING = 50;
84     public final static int NO_FOREIGN_KEYS_ARE_SPECIFIED = 51;
85     public final static int NO_REFERENCE_KEY_IS_SPECIFIED = 52;
86     public final static int NO_RELATION_TABLE = 53;
87     public final static int NO_SOURCE_RELATION_KEYS_SPECIFIED = 54;
88     public final static int NO_SUCH_METHOD_ON_FIND_OBSOLETE_METHOD = 55;
89     public final static int NO_SUCH_METHOD_ON_INITIALIZING_ATTRIBUTE_METHOD = 56;
90     public final static int NO_SUCH_METHOD_WHILE_CONSTRUCTOR_INSTANTIATION = 57;
91     public final static int NO_SUCH_METHOD_WHILE_CONVERTING_TO_METHOD = 58;
92     public final static int NO_SUCH_FIELD_WHILE_INITIALIZING_ATTRIBUTES_IN_INSTANCE_VARIABLE_ACCESSOR = 59;
93     public final static int NO_SUCH_METHOD_WHILE_INITIALIZING_ATTRIBUTES_IN_METHOD_ACCESSOR = 60;
94     public final static int NO_SUCH_METHOD_WHILE_INITIALIZING_CLASS_EXTRACTION_METHOD = 61;
95     public final static int NO_SUCH_METHOD_WHILE_INITIALIZING_COPY_POLICY = 62;
96     public final static int NO_SUCH_METHOD_WHILE_INITIALIZING_INSTANTIATION_POLICY = 63;
97     public final static int NO_TARGET_FOREIGN_KEYS_SPECIFIED = 64;
98     public final static int NO_TARGET_RELATION_KEYS_SPECIFIED = 65;
99     public final static int NOT_DESERIALIZABLE = 66;
100     public final static int NOT_SERIALIZABLE = 67;
101     public final static int NULL_FOR_NON_NULL_AGGREGATE = 68;
102     public final static int NULL_POINTER_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR = 69;
103     public final static int NULL_POINTER_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR = 70;
104     public final static int NULL_POINTER_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR = 71;
105     public final static int NULL_POINTER_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR = 72;
106     public final static int PARENT_DESCRIPTOR_NOT_SPECIFIED = 73;
107     public final static int PRIMARY_KEY_FIELDS_NOT_SPECIFIED = 74;
108     public final static int REFERENCE_CLASS_NOT_SPECIFIED = 75;
109     public final static int REFERENCE_DESCRIPTOR_IS_NOT_AGGREGATE = 77;
110     public final static int REFERENCE_KEY_FIELD_NOT_PROPERLY_SPECIFIED = 78;
111     public final static int REFERENCE_TABLE_NOT_SPECIFIED = 79;
112     public final static int RELATION_KEY_FIELD_NOT_PROPERLY_SPECIFIED = 80;
113     public final static int RETURN_TYPE_IN_GET_ATTRIBUTE_ACCESSOR = 81;
114     public final static int SECURITY_ON_FIND_METHOD = 82;
115     public final static int SECURITY_ON_FIND_OBSOLETE_METHOD = 83;
116     public final static int SECURITY_ON_INITIALIZING_ATTRIBUTE_METHOD = 84;
117     public final static int SECURITY_WHILE_CONVERTING_TO_METHOD = 85;
118     public final static int SECURITY_WHILE_INITIALIZING_ATTRIBUTES_IN_INSTANCE_VARIABLE_ACCESSOR = 86;
119     public final static int SECURITY_WHILE_INITIALIZING_ATTRIBUTES_IN_METHOD_ACCESSOR = 87;
120     public final static int SECURITY_WHILE_INITIALIZING_CLASS_EXTRACTION_METHOD = 88;
121     public final static int SECURITY_WHILE_INITIALIZING_COPY_POLICY = 89;
122     public final static int SECURITY_WHILE_INITIALIZING_INSTANTIATION_POLICY = 90;
123     public final static int SEQUENCE_NUMBER_PROPERTY_NOT_SPECIFIED = 91;
124     public final static int SIZE_MISMATCH_OF_FOREIGN_KEYS = 92;
125     public final static int TABLE_NOT_PRESENT = 93;
126     public final static int TABLE_NOT_SPECIFIED = 94;
127     public final static int TARGET_FOREIGN_KEYS_SIZE_MISMATCH = 96;
128     public final static int TARGET_INVOCATION_WHILE_CLONING = 97;
129     public final static int TARGET_INVOCATION_WHILE_EVENT_EXECUTION = 98;
130     public final static int TARGET_INVOCATION_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR = 99;
131     public final static int TARGET_INVOCATION_WHILE_INSTANTIATING_METHOD_BASED_PROXY = 100;
132     public final static int TARGET_INVOCATION_WHILE_INVOKING_ATTRIBUTE_METHOD = 101;
133     public final static int TARGET_INVOCATION_WHILE_INVOKING_FIELD_TO_METHOD = 102;
134     public final static int TARGET_INVOCATION_WHILE_INVOKING_ROW_EXTRACTION_METHOD = 103;
135     public final static int TARGET_INVOCATION_WHILE_METHOD_INSTANTIATION = 104;
136     public final static int TARGET_INVOCATION_WHILE_OBSOLETE_EVENT_EXECUTION = 105;
137     public final static int TARGET_INVOCATION_WHILE_SETTING_VALUE_THRU_METHOD_ACESSOR = 106;
138     public final static int VALUE_NOT_FOUND_IN_CLASS_INDICATOR_MAPPING = 108;
139     public final static int WRITE_LOCK_FIELD_IN_CHILD_DESCRIPTOR = 109;
140     public final static int DESCRIPTOR_IS_MISSING = 110;
141     public final static int MULTIPLE_TABLE_PRIMARY_KEY_MUST_BE_FULLY_QUALIFIED = 111;
142     public final static int ONLY_ONE_TABLE_CAN_BE_ADDED_WITH_THIS_METHOD = 112;
143     public final static int NULL_POINTER_WHILE_CONSTRUCTOR_INSTANTIATION = 113;
144     public final static int NULL_POINTER_WHILE_METHOD_INSTANTIATION = 114;
145     public final static int NO_ATTRBUTE_VALUE_CONVERSION_TO_FIELD_VALUE_PROVIDED = 115;
146     public final static int NO_FIELD_VALUE_CONVERSION_TO_ATTRIBUTE_VALUE_PROVIDED = 116;
147     public final static int LOCK_MAPPING_CANNOT_BE_READONLY = 118;
148     public final static int LOCK_MAPPING_MUST_BE_READONLY = 119;
149     public final static int CHILD_DOES_NOT_DEFINE_ABSTRACT_QUERY_KEY = 120;
150     public final static int SET_EXISTENCE_CHECKING_NOT_UNDERSTOOD = 122;
151     public final static int VALUE_HOLDER_INSTANTIATION_MISMATCH = 125;
152     public final static int NO_SUB_CLASS_MATCH = 126;
153     public final static int RETURN_AND_MAPPING_WITH_INDIRECTION_MISMATCH = 127;
154     public final static int RETURN_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH = 128;
155     public final static int PARAMETER_AND_MAPPING_WITH_INDIRECTION_MISMATCH = 129;
156     public final static int PARAMETER_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH = 130;
157     public final static int GET_METHOD_RETURN_TYPE_NOT_VALID = 131;
158     public final static int SET_METHOD_PARAMETER_TYPE_NOT_VALID = 133;
159     public final static int ILLEGAL_TABLE_NAME_IN_MULTIPLE_TABLE_FOREIGN_KEY = 135;
160     public final static int ATTRIBUTE_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH = 138;
161     public final static int RETURN_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH = 139;
162     public final static int PARAMETER_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH = 140;
163     public final static int FIELD_IS_NOT_PRESENT_IN_DATABASE = 141;
164     public final static int TABLE_IS_NOT_PRESENT_IN_DATABASE = 142;
165     public final static int MULTIPLE_TABLE_INSERT_ORDER_MISMATCH = 143;
166     public final static int INVALID_USE_OF_TRANSPARENT_INDIRECTION = 144;
167     public final static int MISSING_INDIRECT_CONTAINER_CONSTRUCTOR = 145;
168     public final static int COULD_NOT_INSTANTIATE_INDIRECT_CONTAINER_CLASS = 146;
169     public final static int INVALID_CONTAINER_POLICY = 147;
170     public final static int INVALID_CONTAINER_POLICY_WITH_TRANSPARENT_INDIRECTION = 148;
171     public final static int INVALID_USE_OF_NO_INDIRECTION = 149;
172     public final static int INDIRECT_CONTAINER_INSTANTIATION_MISMATCH = 150;
173     public final static int INVALID_MAPPING_OPERATION = 151;
174     public final static int INVALID_INDIRECTION_POLICY_OPERATION = 152;
175     public final static int REFERENCE_DESCRIPTOR_IS_NOT_AGGREGATECOLLECTION = 153;
176     public final static int INVALID_INDIRECTION_CONTAINER_CLASS = 154;
177     public final static int MISSING_FOREIGN_KEY_TRANSLATION = 155;
178     public final static int STRUCTURE_NAME_NOT_SET_IN_MAPPING = 156;
179     public final static int NORMAL_DESCRIPTORS_DO_NOT_SUPPORT_NON_RELATIONAL_EXTENSIONS = 157;
180     public final static int PARENT_CLASS_IS_SELF = 158;
181     public final static int PROXY_INDIRECTION_NOT_AVAILABLE = 159;
182     public final static int INVALID_ATTRIBUTE_TYPE_FOR_PROXY_INDIRECTION = 160;
183     public final static int INVALID_GET_RETURN_TYPE_FOR_PROXY_INDIRECTION = 161;
184     public final static int INVALID_SET_PARAMETER_TYPE_FOR_PROXY_INDIRECTION = 162;
185     public final static int INCORRECT_COLLECTION_POLICY = 163;
186     public final static int INVALID_AMENDMENT_METHOD = 164;
187     public final static int ERROR_OCCURED_IN_AMENDMENT_METHOD = 165;
188     public final static int VARIABLE_ONE_TO_ONE_MAPPING_IS_NOT_DEFINED = 166;
189     public final static int NO_CONSTRUCTOR_INDIRECT_COLLECTION_CLASS = 167;
190     public final static int TARGET_INVOCATION_WHILE_CONSTRUCTOR_INSTANTIATION = 168;
191     public final static int TARGET_INVOCATION_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY = 169;
192     public final static int ILLEGAL_ACCESS_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY = 170;
193     public final static int INSTANTIATION_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY = 171;
194     public final static int NO_SUCH_METHOD_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY = 172;
195     public final static int NULL_POINTER_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY = 173;
196     public final static int ILLEGAL_ACCESS_WHILE_METHOD_INSTANTIATION_OF_FACTORY = 174;
197     public final static int TARGET_INVOCATION_WHILE_METHOD_INSTANTIATION_OF_FACTORY = 175;
198     public final static int NULL_POINTER_WHILE_METHOD_INSTANTIATION_OF_FACTORY = 176;
199     public final static int NO_MAPPING_FOR_ATTRIBUTENAME = 177;
200     public final static int NO_MAPPING_FOR_ATTRIBUTENAME_IN_ENTITY_BEAN = 178;
201     public final static int UNSUPPORTED_TYPE_FOR_BIDIRECTIONAL_RELATIONSHIP_MAINTENANCE = 179;// Bug 2618982
202
public final static int REFERENCE_DESCRIPTOR_CANNOT_BE_AGGREGATE = 180;
203     public final static int ATTRIBUTE_TRANSFORMER_CLASS_NOT_FOUND = 181;
204     public final static int FIELD_TRANSFORMER_CLASS_NOT_FOUND = 182;
205     public final static int ATTRIBUTE_TRANSFORMER_CLASS_INVALID = 183;
206     public final static int FIELD_TRANSFORMER_CLASS_INVALID = 184;
207     public final static int RETURNING_POLICY_FIELD_TYPE_CONFLICT = 185;
208     public final static int RETURNING_POLICY_FIELD_INSERT_CONFLICT = 186;
209     public final static int RETURNING_POLICY_AND_DESCRIPTOR_FIELD_TYPE_CONFLICT = 187;
210     public final static int RETURNING_POLICY_UNMAPPED_FIELD_TYPE_NOT_SET = 188;
211     public final static int RETURNING_POLICY_MAPPED_FIELD_TYPE_NOT_SET = 189;
212     public final static int RETURNING_POLICY_MAPPING_NOT_SUPPORTED = 190;
213     public final static int RETURNING_POLICY_FIELD_NOT_SUPPORTED = 191;
214     public final static int CUSTOM_QUERY_AND_RETURNING_POLICY_CONFLICT = 192;
215     public final static int NO_CUSTOM_QUERY_FOR_RETURNING_POLICY = 193;
216     public final static int CLASS_EXTRACTION_METHOD_MUST_BE_STATIC = 194;
217     public final static int ISOLATED_DESCRIPTOR_REFERENCED_BY_SHARED_DESCRIPTOR = 195;
218     public final static int UPDATE_ALL_FIELDS_NOT_SET = 196;
219     public final static int INVALID_MAPPING_TYPE = 197;
220     public final static int NEED_TO_IMPLEMENT_CHANGETRACKER = 198;
221     public final static int NEED_TO_IMPLEMENT_FETCHGROUPTRACKER = 199;
222     public final static int ATTEMPT_TO_REGISTER_DEAD_INDIRECTION = 200;
223     public final static int INTERNAL_ERROR_ACCESSING_PKFIELD = 201;
224
225     /**
226      * INTERNAL:
227      * TopLink exceptions should only be thrown by TopLink.
228      */

229     protected DescriptorException(String JavaDoc theMessage) {
230         super(theMessage);
231     }
232
233     /**
234      * INTERNAL:
235      * TopLink exceptions should only be thrown by TopLink.
236      */

237     protected DescriptorException(String JavaDoc theMessage, DatabaseMapping mapping) {
238         this(theMessage);
239         if (mapping != null) {
240             this.mapping = mapping;
241             this.descriptor = mapping.getDescriptor();
242         }
243     }
244
245     /**
246      * INTERNAL:
247      * TopLink exceptions should only be thrown by TopLink.
248      */

249     protected DescriptorException(String JavaDoc theMessage, ClassDescriptor descriptor) {
250         this(theMessage);
251         this.descriptor = descriptor;
252     }
253
254     protected DescriptorException(String JavaDoc theMessage, ClassDescriptor descriptor, Throwable JavaDoc exception) {
255         this(theMessage, descriptor);
256         setInternalException(exception);
257     }
258
259     public static DescriptorException attemptToRegisterDeadIndirection(Object JavaDoc object, DatabaseMapping mapping) {
260         Object JavaDoc[] args = { object };
261
262         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTEMPT_TO_REGISTER_DEAD_INDIRECTION, args), mapping);
263         exception.setErrorCode(ATTEMPT_TO_REGISTER_DEAD_INDIRECTION);
264         return exception;
265     }
266
267     public static DescriptorException attributeAndMappingWithIndirectionMismatch(DatabaseMapping mapping) {
268         Object JavaDoc[] args = { mapping.getAttributeName() };
269
270         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_AND_MAPPING_WITH_INDIRECTION_MISMATCH, args), mapping);
271         exception.setErrorCode(ATTRIBUTE_AND_MAPPING_WITH_INDIRECTION_MISMATCH);
272         return exception;
273     }
274
275     public static DescriptorException attributeAndMappingWithoutIndirectionMismatch(DatabaseMapping mapping) {
276         Object JavaDoc[] args = { mapping.getAttributeName() };
277
278         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH, args), mapping);
279         exception.setErrorCode(ATTRIBUTE_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH);
280         return exception;
281     }
282
283     public static DescriptorException attributeAndMappingWithTransparentIndirectionMismatch(DatabaseMapping mapping, String JavaDoc validTypeName) {
284         Object JavaDoc[] args = { mapping.getAttributeName(), validTypeName };
285
286         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH, args), mapping);
287         exception.setErrorCode(ATTRIBUTE_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH);
288         return exception;
289     }
290
291     public static DescriptorException attributeNameNotSpecified() {
292         Object JavaDoc[] args = { };
293
294         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_NAME_NOT_SPECIFIED, args));
295         descriptorException.setErrorCode(ATTRIBUTE_NAME_NOT_SPECIFIED);
296         return descriptorException;
297     }
298
299     public static DescriptorException attributeTypeNotValid(CollectionMapping mapping) {
300         Object JavaDoc[] args = { mapping.getAttributeName() };
301
302         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_TYPE_NOT_VALID, args), mapping);
303         exception.setErrorCode(ATTRIBUTE_TYPE_NOT_VALID);
304         return exception;
305     }
306
307     public static DescriptorException childDoesNotDefineAbstractQueryKeyOfParent(ClassDescriptor child, ClassDescriptor parent, String JavaDoc queryKeyName) {
308         Object JavaDoc[] args = { queryKeyName, parent, child };
309
310         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, CHILD_DOES_NOT_DEFINE_ABSTRACT_QUERY_KEY, args));
311         descriptorException.setErrorCode(CHILD_DOES_NOT_DEFINE_ABSTRACT_QUERY_KEY);
312         return descriptorException;
313     }
314
315     public static DescriptorException classIndicatorFieldNotFound(ClassDescriptor parentDescriptor, ClassDescriptor descriptor) {
316         Object JavaDoc[] args = { descriptor, parentDescriptor, CR };
317
318         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, CLASS_INDICATOR_FIELD_NOT_FOUND, args), descriptor);
319         descriptorException.setErrorCode(CLASS_INDICATOR_FIELD_NOT_FOUND);
320         return descriptorException;
321     }
322
323     public static DescriptorException couldNotInstantiateIndirectContainerClass(Class JavaDoc containerClass, Exception JavaDoc exception) {
324         Object JavaDoc[] args = { containerClass, Helper.getShortClassName(containerClass) };
325
326         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, COULD_NOT_INSTANTIATE_INDIRECT_CONTAINER_CLASS, args));
327         descriptorException.setErrorCode(COULD_NOT_INSTANTIATE_INDIRECT_CONTAINER_CLASS);
328         descriptorException.setInternalException(exception);
329         return descriptorException;
330     }
331
332     public static DescriptorException descriptorForInterfaceIsMissing(String JavaDoc interfaceName) {
333         Object JavaDoc[] args = { interfaceName };
334
335         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, DESCRIPTOR_FOR_INTERFACE_IS_MISSING, args));
336         descriptorException.setErrorCode(DESCRIPTOR_FOR_INTERFACE_IS_MISSING);
337         return descriptorException;
338     }
339
340     public static DescriptorException descriptorIsMissing(String JavaDoc className, DatabaseMapping mapping) {
341         Object JavaDoc[] args = { className };
342
343         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, DESCRIPTOR_IS_MISSING, args), mapping);
344         descriptorException.setErrorCode(DESCRIPTOR_IS_MISSING);
345         return descriptorException;
346     }
347
348     public static DescriptorException directFieldNameNotSet(DatabaseMapping mapping) {
349         Object JavaDoc[] args = { };
350
351         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, DIRECT_FIELD_NAME_NOT_SET, args), mapping);
352         descriptorException.setErrorCode(DIRECT_FIELD_NAME_NOT_SET);
353         return descriptorException;
354     }
355
356     public static DescriptorException errorOccuredInAmendmentMethod(Class JavaDoc amendmentClass, String JavaDoc method, Exception JavaDoc exception, ClassDescriptor descriptor) {
357         Object JavaDoc[] args = { };
358
359         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ERROR_OCCURED_IN_AMENDMENT_METHOD, args), descriptor, exception);
360         descriptorException.setErrorCode(ERROR_OCCURED_IN_AMENDMENT_METHOD);
361         return descriptorException;
362     }
363
364     public static DescriptorException fieldIsNotPresentInDatabase(ClassDescriptor descriptor, String JavaDoc tableName, String JavaDoc fieldName) {
365         Object JavaDoc[] args = { fieldName, tableName };
366
367         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, FIELD_IS_NOT_PRESENT_IN_DATABASE, args), descriptor);
368         descriptorException.setErrorCode(FIELD_IS_NOT_PRESENT_IN_DATABASE);
369         return descriptorException;
370     }
371
372     public static DescriptorException fieldNameNotSetInMapping(DatabaseMapping mapping) {
373         Object JavaDoc[] args = { };
374
375         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, FIELD_NAME_NOT_SET_IN_MAPPING, args), mapping);
376         descriptorException.setErrorCode(FIELD_NAME_NOT_SET_IN_MAPPING);
377         return descriptorException;
378     }
379
380     public static DescriptorException foreignKeysDefinedIncorrectly(ForeignReferenceMapping mapping) {
381         Object JavaDoc[] args = { };
382
383         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, FOREIGN_KEYS_DEFINED_INCORRECTLY, args), mapping);
384         descriptorException.setErrorCode(FOREIGN_KEYS_DEFINED_INCORRECTLY);
385         return descriptorException;
386     }
387
388     /**
389      * PUBLIC:
390      * Return the descriptor that the problem was detected in.
391      */

392     public ClassDescriptor getDescriptor() {
393         return descriptor;
394     }
395
396     /**
397      * PUBLIC:
398      * Return the mapping that the problem was detected in.
399      */

400     public DatabaseMapping getMapping() {
401         return mapping;
402     }
403
404     /**
405      * PUBLIC:
406      * Return the exception error message.
407      * TopLink error messages are multi-line so that detail descriptions of the exception are given.
408      */

409     public String JavaDoc getMessage() {
410         if (getDescriptor() == null) {
411             return super.getMessage();
412         }
413
414         if (getMapping() != null) {
415             return super.getMessage() + cr() + getIndentationString() + ExceptionMessageGenerator.getHeader("MappingHeader") + getMapping().toString() + cr() + getIndentationString() + ExceptionMessageGenerator.getHeader("DescriptorHeader") + getDescriptor().toString();
416         } else {
417             return super.getMessage() + cr() + getIndentationString() + ExceptionMessageGenerator.getHeader("DescriptorHeader") + getDescriptor().toString();
418         }
419     }
420
421     public static DescriptorException getMethodReturnTypeNotValid(CollectionMapping mapping) {
422         Object JavaDoc[] args = { mapping.getAttributeName() };
423
424         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, GET_METHOD_RETURN_TYPE_NOT_VALID, args), mapping);
425         exception.setErrorCode(GET_METHOD_RETURN_TYPE_NOT_VALID);
426         return exception;
427     }
428
429     public static DescriptorException identityMapNotSpecified(ClassDescriptor descriptor) {
430         Object JavaDoc[] args = { };
431
432         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, IDENTITY_MAP_NOT_SPECIFIED, args), descriptor);
433         descriptorException.setErrorCode(IDENTITY_MAP_NOT_SPECIFIED);
434         return descriptorException;
435     }
436
437     public static DescriptorException illegalAccesstWhileGettingValueThruInstanceVaraibleAccessor(String JavaDoc attributeName, String JavaDoc objectName, Throwable JavaDoc exception) {
438         Object JavaDoc[] args = { attributeName, objectName };
439
440         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR, args));
441         descriptorException.setInternalException(exception);
442         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR);
443         return descriptorException;
444     }
445
446     public static DescriptorException illegalAccessWhileCloning(Object JavaDoc domainObject, String JavaDoc methodName, ClassDescriptor descriptor, Throwable JavaDoc exception) {
447         Object JavaDoc[] args = { domainObject, methodName };
448
449         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_CLONING, args), descriptor, exception);
450         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_CLONING);
451         return descriptorException;
452     }
453
454     public static DescriptorException illegalAccessWhileConstructorInstantiation(ClassDescriptor descriptor, Exception JavaDoc exception) {
455         Object JavaDoc[] args = { };
456
457         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_CONSTRUCTOR_INSTANTIATION, args), descriptor, exception);
458         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_CONSTRUCTOR_INSTANTIATION);
459         return descriptorException;
460     }
461
462     public static DescriptorException illegalAccessWhileConstructorInstantiationOfFactory(ClassDescriptor descriptor, Exception JavaDoc exception) {
463         Object JavaDoc[] args = { };
464
465         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
466         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY);
467         return descriptorException;
468     }
469
470     public static DescriptorException illegalAccessWhileEventExecution(String JavaDoc eventMethodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
471         Object JavaDoc[] args = { eventMethodName };
472
473         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_EVENT_EXECUTION, args), descriptor, exception);
474         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_EVENT_EXECUTION);
475         return descriptorException;
476     }
477
478     public static DescriptorException illegalAccessWhileGettingValueThruMethodAccessor(String JavaDoc methodName, String JavaDoc objectName, Throwable JavaDoc exception) {
479         Object JavaDoc[] args = { methodName, objectName };
480
481         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR, args));
482         descriptorException.setInternalException(exception);
483         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR);
484         return descriptorException;
485     }
486
487     public static DescriptorException illegalAccessWhileInstantiatingMethodBasedProxy(Throwable JavaDoc exception) {
488         Object JavaDoc[] args = { };
489
490         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_INSTANTIATING_METHOD_BASED_PROXY, args));
491         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_INSTANTIATING_METHOD_BASED_PROXY);
492         descriptorException.setInternalException(exception);
493         return descriptorException;
494     }
495
496     public static DescriptorException illegalAccessWhileInvokingAttributeMethod(DatabaseMapping mapping, Throwable JavaDoc exception) {
497         Object JavaDoc[] args = { };
498
499         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_INVOKING_ATTRIBUTE_METHOD, args));
500         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_INVOKING_ATTRIBUTE_METHOD);
501         descriptorException.setInternalException(exception);
502         descriptorException.setMapping(mapping);
503         return descriptorException;
504     }
505
506     public static DescriptorException illegalAccessWhileInvokingFieldToMethod(String JavaDoc methodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
507         Object JavaDoc[] args = { methodName };
508
509         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_INVOKING_FIELD_TO_METHOD, args));
510         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_INVOKING_FIELD_TO_METHOD);
511         descriptorException.setInternalException(exception);
512         descriptorException.setMapping(mapping);
513         return descriptorException;
514     }
515
516     public static DescriptorException illegalAccessWhileInvokingRowExtractionMethod(AbstractRecord row, Method method, ClassDescriptor descriptor, Throwable JavaDoc exception) {
517         Object JavaDoc[] args = { row, method };
518
519         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_INVOKING_ROW_EXTRACTION_METHOD, args), descriptor, exception);
520         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_INVOKING_ROW_EXTRACTION_METHOD);
521         return descriptorException;
522     }
523
524     public static DescriptorException illegalAccessWhileMethodInstantiation(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
525         Object JavaDoc[] args = { methodName };
526
527         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_METHOD_INSTANTIATION, args), descriptor, exception);
528         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_METHOD_INSTANTIATION);
529         return descriptorException;
530     }
531
532     public static DescriptorException illegalAccessWhileMethodInstantiationOfFactory(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
533         Object JavaDoc[] args = { methodName };
534
535         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_METHOD_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
536         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_METHOD_INSTANTIATION_OF_FACTORY);
537         return descriptorException;
538     }
539
540     public static DescriptorException illegalAccessWhileObsoleteEventExecute(String JavaDoc eventMethodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
541         Object JavaDoc[] args = { eventMethodName };
542
543         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_OBSOLETE_EVENT_EXECUTION, args), descriptor, exception);
544         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_OBSOLETE_EVENT_EXECUTION);
545         return descriptorException;
546     }
547
548     public static DescriptorException illegalAccessWhileSettingValueThruInstanceVariableAccessor(String JavaDoc attributeName, String JavaDoc objectName, Object JavaDoc objectValue, Throwable JavaDoc exception) {
549         Object JavaDoc[] args = { attributeName, objectName, String.valueOf(objectValue), CR };
550
551         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR, args));
552         descriptorException.setInternalException(exception);
553         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR);
554         return descriptorException;
555     }
556
557     public static DescriptorException illegalAccessWhileSettingValueThruMethodAccessor(String JavaDoc setMethodName, Object JavaDoc value, Throwable JavaDoc exception) {
558         Object JavaDoc[] args = { setMethodName, String.valueOf(value) };
559
560         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ACCESS_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR, args));
561         descriptorException.setInternalException(exception);
562         descriptorException.setErrorCode(ILLEGAL_ACCESS_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR);
563         return descriptorException;
564     }
565
566     public static DescriptorException illegalArgumentWhileGettingValueThruInstanceVariableAccessor(String JavaDoc attributeName, String JavaDoc typeName, String JavaDoc objectName, Throwable JavaDoc exception) {
567         Object JavaDoc[] args = { attributeName, typeName, objectName };
568
569         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR, args));
570         descriptorException.setInternalException(exception);
571         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR);
572         return descriptorException;
573     }
574
575     public static DescriptorException illegalArgumentWhileGettingValueThruMethodAccessor(String JavaDoc methodName, String JavaDoc objectName, Throwable JavaDoc exception) {
576         Object JavaDoc[] args = { methodName, objectName };
577
578         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR, args));
579         descriptorException.setInternalException(exception);
580         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR);
581         return descriptorException;
582     }
583
584     public static DescriptorException illegalArgumentWhileInstantiatingMethodBasedProxy(Throwable JavaDoc exception) {
585         Object JavaDoc[] args = { };
586
587         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_INSTANTIATING_METHOD_BASED_PROXY, args));
588         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_INSTANTIATING_METHOD_BASED_PROXY);
589         descriptorException.setInternalException(exception);
590         return descriptorException;
591     }
592
593     public static DescriptorException illegalArgumentWhileInvokingAttributeMethod(DatabaseMapping mapping, Throwable JavaDoc exception) {
594         Object JavaDoc[] args = { };
595
596         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_INVOKING_ATTRIBUTE_METHOD, args));
597         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_INVOKING_ATTRIBUTE_METHOD);
598         descriptorException.setInternalException(exception);
599         descriptorException.setMapping(mapping);
600         return descriptorException;
601     }
602
603     public static DescriptorException illegalArgumentWhileInvokingFieldToMethod(String JavaDoc methodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
604         Object JavaDoc[] args = { methodName };
605
606         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_INVOKING_FIELD_TO_METHOD, args));
607         descriptorException.setInternalException(exception);
608         descriptorException.setMapping(mapping);
609         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_INVOKING_FIELD_TO_METHOD);
610         return descriptorException;
611     }
612
613     public static DescriptorException illegalArgumentWhileObsoleteEventExecute(String JavaDoc eventMethodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
614         Object JavaDoc[] args = { eventMethodName };
615
616         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_OBSOLETE_EVENT_EXECUTION, args), descriptor, exception);
617         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_OBSOLETE_EVENT_EXECUTION);
618         return descriptorException;
619     }
620
621     public static DescriptorException illegalArgumentWhileSettingValueThruInstanceVariableAccessor(String JavaDoc attributeName, String JavaDoc typeName, Object JavaDoc value, Throwable JavaDoc exception) {
622         Object JavaDoc[] args = { String.valueOf(value), attributeName, typeName };
623
624         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR, args));
625         descriptorException.setInternalException(exception);
626         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR);
627         return descriptorException;
628     }
629
630     public static DescriptorException illegalArgumentWhileSettingValueThruMethodAccessor(String JavaDoc setMethodName, Object JavaDoc value, Throwable JavaDoc exception) {
631         Object JavaDoc[] args = { setMethodName, String.valueOf(value) };
632
633         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_ARGUMENT_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR, args));
634         descriptorException.setInternalException(exception);
635         descriptorException.setErrorCode(ILLEGAL_ARGUMENT_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR);
636         return descriptorException;
637     }
638
639     public static DescriptorException illegalTableNameInMultipleTableForeignKeyField(ClassDescriptor descriptor, DatabaseTable table) {
640         Object JavaDoc[] args = { table };
641
642         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ILLEGAL_TABLE_NAME_IN_MULTIPLE_TABLE_FOREIGN_KEY, args), descriptor);
643         descriptorException.setErrorCode(ILLEGAL_TABLE_NAME_IN_MULTIPLE_TABLE_FOREIGN_KEY);
644         return descriptorException;
645     }
646
647     public static DescriptorException incorrectCollectionPolicy(DatabaseMapping mapping, Class JavaDoc attributeClass, Class JavaDoc containerClass) {
648         Object JavaDoc[] args = { attributeClass, containerClass };
649
650         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INCORRECT_COLLECTION_POLICY, args), mapping);
651         descriptorException.setErrorCode(INCORRECT_COLLECTION_POLICY);
652         return descriptorException;
653     }
654
655     public static DescriptorException indirectContainerInstantiationMismatch(Object JavaDoc attributeValue, DatabaseMapping mapping) {
656         Object JavaDoc[] args = { mapping.getAttributeName(), attributeValue, CR };
657
658         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INDIRECT_CONTAINER_INSTANTIATION_MISMATCH, args), mapping);
659         exception.setErrorCode(INDIRECT_CONTAINER_INSTANTIATION_MISMATCH);
660         return exception;
661     }
662
663     public static DescriptorException instantiationWhileConstructorInstantiation(ClassDescriptor descriptor, Exception JavaDoc exception) {
664         Object JavaDoc[] args = { };
665
666         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INSTANTIATION_WHILE_CONSTRUCTOR_INSTANTIATION, args), descriptor, exception);
667         descriptorException.setErrorCode(INSTANTIATION_WHILE_CONSTRUCTOR_INSTANTIATION);
668         return descriptorException;
669     }
670
671     public static DescriptorException instantiationWhileConstructorInstantiationOfFactory(ClassDescriptor descriptor, Exception JavaDoc exception) {
672         Object JavaDoc[] args = { };
673
674         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INSTANTIATION_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
675         descriptorException.setErrorCode(INSTANTIATION_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY);
676         return descriptorException;
677     }
678
679     public static DescriptorException invalidAmendmentMethod(Class JavaDoc amendmentClass, String JavaDoc method, Exception JavaDoc exception, ClassDescriptor descriptor) {
680         Object JavaDoc[] args = { amendmentClass, method, CR };
681
682         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_AMENDMENT_METHOD, args), descriptor, exception);
683         descriptorException.setErrorCode(INVALID_AMENDMENT_METHOD);
684         return descriptorException;
685     }
686
687     public static DescriptorException invalidAttributeTypeForProxyIndirection(Class JavaDoc attributeType, Class JavaDoc[] targetInterfaces, DatabaseMapping mapping) {
688         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
689         for (int i = 0; i < targetInterfaces.length; i++) {
690             buffer.append(((Class JavaDoc)targetInterfaces[i]).getName());
691             if (i != (targetInterfaces.length - 1)) {
692                 buffer.append(", ");
693             }
694         }
695
696         Object JavaDoc[] args = { mapping.getAttributeName(), mapping.getDescriptor().getJavaClass().getName(), attributeType.getName(), buffer.toString(), CR };
697
698         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_ATTRIBUTE_TYPE_FOR_PROXY_INDIRECTION, args), mapping);
699         descriptorException.setErrorCode(INVALID_ATTRIBUTE_TYPE_FOR_PROXY_INDIRECTION);
700         return descriptorException;
701     }
702
703     public static DescriptorException invalidContainerPolicy(oracle.toplink.essentials.internal.queryframework.ContainerPolicy containerPolicy, Class JavaDoc javaClass) {
704         Object JavaDoc[] args = { containerPolicy, javaClass };
705
706         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_CONTAINER_POLICY, args));
707         exception.setErrorCode(INVALID_CONTAINER_POLICY);
708         return exception;
709     }
710
711     public static DescriptorException invalidContainerPolicyWithTransparentIndirection(DatabaseMapping mapping, oracle.toplink.essentials.internal.queryframework.ContainerPolicy containerPolicy) {
712         Object JavaDoc[] args = { containerPolicy };
713
714         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_CONTAINER_POLICY_WITH_TRANSPARENT_INDIRECTION, args), mapping);
715         exception.setErrorCode(INVALID_CONTAINER_POLICY_WITH_TRANSPARENT_INDIRECTION);
716         return exception;
717     }
718
719     public static DescriptorException invalidDataModificationEvent(DatabaseMapping mapping) {
720         Object JavaDoc[] args = { };
721
722         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_DATA_MODIFICATION_EVENT, args), mapping);
723         descriptorException.setErrorCode(INVALID_DATA_MODIFICATION_EVENT);
724         return descriptorException;
725     }
726
727     public static DescriptorException invalidDataModificationEventCode(Object JavaDoc event, ForeignReferenceMapping mapping) {
728         Object JavaDoc[] args = { event };
729
730         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_DATA_MODIFICATION_EVENT_CODE, args), mapping);
731         descriptorException.setErrorCode(INVALID_DATA_MODIFICATION_EVENT_CODE);
732         return descriptorException;
733     }
734
735     public static DescriptorException invalidDescriptorEventCode(DescriptorEvent event, ClassDescriptor descriptor) {
736         Object JavaDoc[] args = { new Integer JavaDoc(event.getEventCode()) };
737
738         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_DESCRIPTOR_EVENT_CODE, args), descriptor);
739         descriptorException.setErrorCode(INVALID_DESCRIPTOR_EVENT_CODE);
740         return descriptorException;
741     }
742
743     public static DescriptorException invalidGetMethodReturnTypeForProxyIndirection(Class JavaDoc attributeType, Class JavaDoc[] targetInterfaces, DatabaseMapping mapping) {
744         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
745         for (int i = 0; i < targetInterfaces.length; i++) {
746             buffer.append(((Class JavaDoc)targetInterfaces[i]).getName());
747             if (i != (targetInterfaces.length - 1)) {
748                 buffer.append(", ");
749             }
750         }
751
752         Object JavaDoc[] args = { mapping.getGetMethodName(), mapping.getDescriptor().getJavaClass().getName(), attributeType.getName(), buffer.toString(), CR };
753
754         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_GET_RETURN_TYPE_FOR_PROXY_INDIRECTION, args), mapping);
755         descriptorException.setErrorCode(INVALID_GET_RETURN_TYPE_FOR_PROXY_INDIRECTION);
756         return descriptorException;
757     }
758
759     public static DescriptorException invalidIdentityMap(ClassDescriptor descriptor, Throwable JavaDoc exception) {
760         Object JavaDoc[] args = { };
761
762         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_IDENTITY_MAP, args), descriptor, exception);
763         descriptorException.setErrorCode(INVALID_IDENTITY_MAP);
764         return descriptorException;
765     }
766
767     public static DescriptorException invalidIndirectionPolicyOperation(oracle.toplink.essentials.internal.indirection.IndirectionPolicy policy, String JavaDoc operation) {
768         Object JavaDoc[] args = { policy, operation };
769
770         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_INDIRECTION_POLICY_OPERATION, args), policy.getMapping());
771         descriptorException.setErrorCode(INVALID_INDIRECTION_POLICY_OPERATION);
772         return descriptorException;
773     }
774
775     public static DescriptorException invalidMappingOperation(DatabaseMapping mapping, String JavaDoc operation) {
776         Object JavaDoc[] args = { operation };
777
778         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_MAPPING_OPERATION, args), mapping);
779         descriptorException.setErrorCode(INVALID_MAPPING_OPERATION);
780         return descriptorException;
781     }
782
783     public static DescriptorException invalidSetMethodParameterTypeForProxyIndirection(Class JavaDoc attributeType, Class JavaDoc[] targetInterfaces, DatabaseMapping mapping) {
784         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
785         for (int i = 0; i < targetInterfaces.length; i++) {
786             buffer.append(((Class JavaDoc)targetInterfaces[i]).getName());
787             if (i != (targetInterfaces.length - 1)) {
788                 buffer.append(", ");
789             }
790         }
791
792         Object JavaDoc[] args = { mapping.getSetMethodName(), mapping.getDescriptor().getJavaClass().getName(), attributeType.getName(), buffer.toString(), CR };
793
794         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_SET_PARAMETER_TYPE_FOR_PROXY_INDIRECTION, args), mapping);
795         descriptorException.setErrorCode(INVALID_SET_PARAMETER_TYPE_FOR_PROXY_INDIRECTION);
796         return descriptorException;
797     }
798
799     public static DescriptorException invalidUseOfNoIndirection(DatabaseMapping mapping) {
800         Object JavaDoc[] args = { };
801
802         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_USE_OF_NO_INDIRECTION, args), mapping);
803         exception.setErrorCode(INVALID_USE_OF_NO_INDIRECTION);
804         return exception;
805     }
806
807     public static DescriptorException invalidUseOfTransparentIndirection(DatabaseMapping mapping) {
808         Object JavaDoc[] args = { };
809
810         String JavaDoc message = oracle.toplink.essentials.exceptions.i18n.ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_USE_OF_TRANSPARENT_INDIRECTION, args);
811         DescriptorException exception = new DescriptorException(message, mapping);
812         exception.setErrorCode(INVALID_USE_OF_TRANSPARENT_INDIRECTION);
813         return exception;
814     }
815
816     public static DescriptorException isolateDescriptorReferencedBySharedDescriptor(String JavaDoc referenceClass, String JavaDoc sourceClass, DatabaseMapping mapping) {
817         Object JavaDoc[] args = { referenceClass, sourceClass };
818
819         String JavaDoc message = oracle.toplink.essentials.exceptions.i18n.ExceptionMessageGenerator.buildMessage(DescriptorException.class, ISOLATED_DESCRIPTOR_REFERENCED_BY_SHARED_DESCRIPTOR, args);
820         DescriptorException exception = new DescriptorException(message, mapping);
821         exception.setErrorCode(ISOLATED_DESCRIPTOR_REFERENCED_BY_SHARED_DESCRIPTOR);
822         return exception;
823     }
824
825     public static DescriptorException javaClassNotSpecified(ClassDescriptor descriptor) {
826         Object JavaDoc[] args = { };
827
828         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, JAVA_CLASS_NOT_SPECIFIED, args), descriptor);
829         descriptorException.setErrorCode(JAVA_CLASS_NOT_SPECIFIED);
830         return descriptorException;
831     }
832
833     public static DescriptorException mappingCanNotBeReadOnly(DatabaseMapping mapping) {
834         Object JavaDoc[] args = { mapping.getDescriptor().getClass() };
835
836         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, LOCK_MAPPING_CANNOT_BE_READONLY, args), mapping);
837         descriptorException.setErrorCode(LOCK_MAPPING_CANNOT_BE_READONLY);
838         return descriptorException;
839     }
840
841     public static DescriptorException mappingForSequenceNumberField(ClassDescriptor descriptor) {
842         Object JavaDoc[] args = { };
843
844         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MAPPING_FOR_SEQUENCE_NUMBER_FIELD, args));
845         descriptorException.setErrorCode(MAPPING_FOR_SEQUENCE_NUMBER_FIELD);
846         descriptorException.setDescriptor(descriptor);
847         return descriptorException;
848     }
849
850     public static DescriptorException missingClassForIndicatorFieldValue(Object JavaDoc classFieldValue, ClassDescriptor descriptor) {
851         Object JavaDoc[] args = { classFieldValue, classFieldValue.getClass() };
852
853         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MISSING_CLASS_FOR_INDICATOR_FIELD_VALUE, args), descriptor);
854         descriptorException.setErrorCode(MISSING_CLASS_FOR_INDICATOR_FIELD_VALUE);
855         return descriptorException;
856     }
857
858     public static DescriptorException missingClassIndicatorField(AbstractRecord row, ClassDescriptor descriptor) {
859         Object JavaDoc[] args = { row };
860
861         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MISSING_CLASS_INDICATOR_FIELD, args), descriptor);
862         descriptorException.setErrorCode(MISSING_CLASS_INDICATOR_FIELD);
863         return descriptorException;
864     }
865
866     public static DescriptorException missingForeignKeyTranslation(ForeignReferenceMapping mapping, DatabaseField primaryKeyField) {
867         Object JavaDoc[] args = { primaryKeyField };
868
869         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MISSING_FOREIGN_KEY_TRANSLATION, args), mapping);
870         exception.setErrorCode(MISSING_FOREIGN_KEY_TRANSLATION);
871         return exception;
872     }
873
874     public static DescriptorException missingIndirectContainerConstructor(Class JavaDoc containerClass) {
875         Object JavaDoc[] args = { containerClass.getName(), containerClass.getName() + "()" };
876
877         DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MISSING_INDIRECT_CONTAINER_CONSTRUCTOR, args));
878         exception.setErrorCode(MISSING_INDIRECT_CONTAINER_CONSTRUCTOR);
879         return exception;
880     }
881
882     public static DescriptorException missingMappingForField(DatabaseField field, ClassDescriptor descriptor) {
883         Object JavaDoc[] args = { field };
884
885         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MISSING_MAPPING_FOR_FIELD, args));
886         descriptorException.setErrorCode(MISSING_MAPPING_FOR_FIELD);
887         descriptorException.setDescriptor(descriptor);
888         return descriptorException;
889     }
890
891     public static DescriptorException multipleTableInsertOrderMismatch(ClassDescriptor aDescriptor) {
892         Object JavaDoc[] args = { aDescriptor.getMultipleTableInsertOrder(), aDescriptor.getTables(), CR };
893
894         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MULTIPLE_TABLE_INSERT_ORDER_MISMATCH, args));
895         descriptorException.setErrorCode(MULTIPLE_TABLE_INSERT_ORDER_MISMATCH);
896         descriptorException.setDescriptor(aDescriptor);
897         return descriptorException;
898     }
899
900     public static DescriptorException multipleTablePrimaryKeyMustBeFullyQualified(ClassDescriptor descriptor) {
901         Object JavaDoc[] args = { };
902
903         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MULTIPLE_TABLE_PRIMARY_KEY_MUST_BE_FULLY_QUALIFIED, args), descriptor);
904         descriptorException.setErrorCode(MULTIPLE_TABLE_PRIMARY_KEY_MUST_BE_FULLY_QUALIFIED);
905         return descriptorException;
906     }
907
908     public static DescriptorException multipleTablePrimaryKeyNotSpecified(ClassDescriptor descriptor) {
909         Object JavaDoc[] args = { };
910
911         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MULTIPLE_TABLE_PRIMARY_KEY_NOT_SPECIFIED, args), descriptor);
912         descriptorException.setErrorCode(MULTIPLE_TABLE_PRIMARY_KEY_NOT_SPECIFIED);
913         return descriptorException;
914     }
915
916     public static DescriptorException multipleWriteMappingsForField(String JavaDoc fieldName, DatabaseMapping mapping) {
917         Object JavaDoc[] args = { fieldName };
918
919         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, MULTIPLE_WRITE_MAPPINGS_FOR_FIELD, args), mapping);
920         descriptorException.setErrorCode(MULTIPLE_WRITE_MAPPINGS_FOR_FIELD);
921         return descriptorException;
922     }
923
924     public static DescriptorException mustBeReadOnlyMappingWhenStoredInCache(DatabaseMapping mapping) {
925         Object JavaDoc[] args = { mapping.getDescriptor().getJavaClass() };
926
927         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, LOCK_MAPPING_MUST_BE_READONLY, args), mapping);
928         descriptorException.setErrorCode(LOCK_MAPPING_MUST_BE_READONLY);
929         return descriptorException;
930     }
931
932     public static DescriptorException noAttributeTransformationMethod(DatabaseMapping mapping) {
933         Object JavaDoc[] args = { };
934
935         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_ATTRIBUTE_TRANSFORMATION_METHOD, args), mapping);
936         descriptorException.setErrorCode(NO_ATTRIBUTE_TRANSFORMATION_METHOD);
937         return descriptorException;
938     }
939
940     public static DescriptorException noAttributeValueConversionToFieldValueProvided(Object JavaDoc attributeValue, DatabaseMapping mapping) {
941         Object JavaDoc[] args = { attributeValue };
942
943         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_ATTRBUTE_VALUE_CONVERSION_TO_FIELD_VALUE_PROVIDED, args), mapping);
944         descriptorException.setErrorCode(NO_ATTRBUTE_VALUE_CONVERSION_TO_FIELD_VALUE_PROVIDED);
945         return descriptorException;
946     }
947
948     public static DescriptorException noFieldNameForMapping(DatabaseMapping mapping) {
949         Object JavaDoc[] args = { };
950
951         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_FIELD_NAME_FOR_MAPPING, args), mapping);
952         descriptorException.setErrorCode(NO_FIELD_NAME_FOR_MAPPING);
953         return descriptorException;
954     }
955
956     // CR#3779 - Added field as an argument
957
public static DescriptorException noFieldValueConversionToAttributeValueProvided(Object JavaDoc fieldValue, DatabaseField field, DatabaseMapping mapping) {
958         Object JavaDoc[] args = { fieldValue, field };
959
960         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_FIELD_VALUE_CONVERSION_TO_ATTRIBUTE_VALUE_PROVIDED, args), mapping);
961         descriptorException.setErrorCode(NO_FIELD_VALUE_CONVERSION_TO_ATTRIBUTE_VALUE_PROVIDED);
962         return descriptorException;
963     }
964
965     public static DescriptorException noForeignKeysAreSpecified(ForeignReferenceMapping mapping) {
966         Object JavaDoc[] args = { };
967
968         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_FOREIGN_KEYS_ARE_SPECIFIED, args), mapping);
969         descriptorException.setErrorCode(NO_FOREIGN_KEYS_ARE_SPECIFIED);
970         return descriptorException;
971     }
972
973     public static DescriptorException noMappingForPrimaryKey(DatabaseField field, ClassDescriptor descriptor) {
974         Object JavaDoc[] args = { field };
975
976         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_MAPPING_FOR_PRIMARY_KEY, args), descriptor);
977         descriptorException.setErrorCode(NO_MAPPING_FOR_PRIMARY_KEY);
978         return descriptorException;
979     }
980
981     public static DescriptorException noReferenceKeyIsSpecified(ForeignReferenceMapping mapping) {
982         Object JavaDoc[] args = { };
983
984         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_REFERENCE_KEY_IS_SPECIFIED, args), mapping);
985         descriptorException.setErrorCode(NO_REFERENCE_KEY_IS_SPECIFIED);
986         return descriptorException;
987     }
988
989     public static DescriptorException noRelationTable(DatabaseMapping mapping) {
990         Object JavaDoc[] args = { };
991
992         DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_RELATION_TABLE, args), mapping);
993         descriptorException.setErrorCode(NO_RELATION_TABLE);
994         return descriptorException;
995     }
996
997     public static DescriptorException normalDescriptorsDoNotSupportNonRelationalExtensions(ClassDescriptor descriptor) {
998         Object JavaDoc[] args = { };
999
1000        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NORMAL_DESCRIPTORS_DO_NOT_SUPPORT_NON_RELATIONAL_EXTENSIONS, args), descriptor);
1001        descriptorException.setErrorCode(NORMAL_DESCRIPTORS_DO_NOT_SUPPORT_NON_RELATIONAL_EXTENSIONS);
1002        return descriptorException;
1003    }
1004
1005    public static DescriptorException noSourceRelationKeysSpecified(ForeignReferenceMapping mapping) {
1006        Object JavaDoc[] args = { };
1007
1008        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SOURCE_RELATION_KEYS_SPECIFIED, args), mapping);
1009        descriptorException.setErrorCode(NO_SOURCE_RELATION_KEYS_SPECIFIED);
1010        return descriptorException;
1011    }
1012
1013    public static DescriptorException noSubClassMatch(Class JavaDoc theClass, DatabaseMapping mapping) {
1014        Object JavaDoc[] args = { theClass };
1015
1016        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUB_CLASS_MATCH, args), mapping);
1017
1018        descriptorException.setErrorCode(NO_SUB_CLASS_MATCH);
1019        return descriptorException;
1020    }
1021
1022    public static DescriptorException noSuchFieldWhileInitializingAttributesInInstanceVariableAccessor(String JavaDoc attributeName, String JavaDoc javaClassName, Throwable JavaDoc exception) {
1023        Object JavaDoc[] args = { attributeName, javaClassName };
1024
1025        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_FIELD_WHILE_INITIALIZING_ATTRIBUTES_IN_INSTANCE_VARIABLE_ACCESSOR, args));
1026        descriptorException.setInternalException(exception);
1027        descriptorException.setErrorCode(NO_SUCH_FIELD_WHILE_INITIALIZING_ATTRIBUTES_IN_INSTANCE_VARIABLE_ACCESSOR);
1028        return descriptorException;
1029    }
1030
1031    public static DescriptorException noSuchMethodOnFindObsoleteMethod(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1032        Object JavaDoc[] args = { methodName };
1033
1034        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_ON_FIND_OBSOLETE_METHOD, args), descriptor, exception);
1035        descriptorException.setErrorCode(NO_SUCH_METHOD_ON_FIND_OBSOLETE_METHOD);
1036        return descriptorException;
1037    }
1038
1039    public static DescriptorException noSuchMethodOnInitializingAttributeMethod(String JavaDoc attributeMethodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
1040        Object JavaDoc[] args = { attributeMethodName };
1041
1042        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_ON_INITIALIZING_ATTRIBUTE_METHOD, args));
1043        descriptorException.setErrorCode(NO_SUCH_METHOD_ON_INITIALIZING_ATTRIBUTE_METHOD);
1044        descriptorException.setMapping(mapping);
1045        descriptorException.setInternalException(exception);
1046        return descriptorException;
1047    }
1048
1049    public static DescriptorException noSuchMethodWhileConstructorInstantiation(ClassDescriptor descriptor, Throwable JavaDoc exception) {
1050        Object JavaDoc[] args = { };
1051
1052        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_CONSTRUCTOR_INSTANTIATION, args), descriptor, exception);
1053        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_CONSTRUCTOR_INSTANTIATION);
1054        return descriptorException;
1055    }
1056
1057    public static DescriptorException noSuchMethodWhileConstructorInstantiationOfFactory(ClassDescriptor descriptor, Throwable JavaDoc exception) {
1058        Object JavaDoc[] args = { };
1059
1060        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
1061        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY);
1062        return descriptorException;
1063    }
1064
1065    public static DescriptorException noSuchMethodWhileConvertingToMethod(String JavaDoc methodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
1066        Object JavaDoc[] args = { methodName };
1067
1068        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_CONVERTING_TO_METHOD, args));
1069        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_CONVERTING_TO_METHOD);
1070        descriptorException.setMapping(mapping);
1071        descriptorException.setInternalException(exception);
1072        return descriptorException;
1073    }
1074
1075    public static DescriptorException noSuchMethodWhileInitializingAttributesInMethodAccessor(String JavaDoc setMethodName, String JavaDoc getMethodName, String JavaDoc javaClassName) {
1076        Object JavaDoc[] args = { setMethodName, getMethodName, javaClassName };
1077
1078        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_INITIALIZING_ATTRIBUTES_IN_METHOD_ACCESSOR, args));
1079        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_INITIALIZING_ATTRIBUTES_IN_METHOD_ACCESSOR);
1080        return descriptorException;
1081    }
1082
1083    public static DescriptorException noSuchMethodWhileInitializingClassExtractionMethod(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1084        Object JavaDoc[] args = { methodName };
1085
1086        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_INITIALIZING_CLASS_EXTRACTION_METHOD, args), descriptor, exception);
1087        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_INITIALIZING_CLASS_EXTRACTION_METHOD);
1088        return descriptorException;
1089    }
1090
1091    public static DescriptorException noSuchMethodWhileInitializingCopyPolicy(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1092        Object JavaDoc[] args = { methodName };
1093
1094        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_INITIALIZING_COPY_POLICY, args), descriptor, exception);
1095        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_INITIALIZING_COPY_POLICY);
1096        return descriptorException;
1097    }
1098
1099    public static DescriptorException noSuchMethodWhileInitializingInstantiationPolicy(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1100        Object JavaDoc[] args = { methodName };
1101
1102        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_SUCH_METHOD_WHILE_INITIALIZING_INSTANTIATION_POLICY, args), descriptor, exception);
1103        descriptorException.setErrorCode(NO_SUCH_METHOD_WHILE_INITIALIZING_INSTANTIATION_POLICY);
1104        return descriptorException;
1105    }
1106
1107    public static DescriptorException noTargetForeignKeysSpecified(ForeignReferenceMapping mapping) {
1108        Object JavaDoc[] args = { };
1109
1110        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_TARGET_FOREIGN_KEYS_SPECIFIED, args), mapping);
1111        descriptorException.setErrorCode(NO_TARGET_FOREIGN_KEYS_SPECIFIED);
1112        return descriptorException;
1113    }
1114
1115    public static DescriptorException noTargetRelationKeysSpecified(ForeignReferenceMapping mapping) {
1116        Object JavaDoc[] args = { };
1117
1118        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_TARGET_RELATION_KEYS_SPECIFIED, args), mapping);
1119        descriptorException.setErrorCode(NO_TARGET_RELATION_KEYS_SPECIFIED);
1120        return descriptorException;
1121    }
1122
1123    public static DescriptorException notDeserializable(DatabaseMapping mapping, Throwable JavaDoc exception) {
1124        Object JavaDoc[] args = { };
1125
1126        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NOT_DESERIALIZABLE, args));
1127        descriptorException.setErrorCode(NOT_DESERIALIZABLE);
1128        descriptorException.setMapping(mapping);
1129        descriptorException.setInternalException(exception);
1130        return descriptorException;
1131    }
1132
1133    public static DescriptorException notSerializable(DatabaseMapping mapping, Throwable JavaDoc exception) {
1134        Object JavaDoc[] args = { };
1135
1136        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NOT_SERIALIZABLE, args));
1137        descriptorException.setErrorCode(NOT_SERIALIZABLE);
1138        descriptorException.setMapping(mapping);
1139        descriptorException.setInternalException(exception);
1140
1141        return descriptorException;
1142    }
1143
1144    public static DescriptorException nullForNonNullAggregate(Object JavaDoc object, DatabaseMapping mapping) {
1145        Object JavaDoc[] args = { object };
1146
1147        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_FOR_NON_NULL_AGGREGATE, args), mapping);
1148        exception.setErrorCode(NULL_FOR_NON_NULL_AGGREGATE);
1149        return exception;
1150    }
1151
1152    public static DescriptorException nullPointerWhileConstructorInstantiation(ClassDescriptor descriptor, Throwable JavaDoc exception) {
1153        Object JavaDoc[] args = { };
1154
1155        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_CONSTRUCTOR_INSTANTIATION, args), descriptor, exception);
1156        descriptorException.setErrorCode(NULL_POINTER_WHILE_CONSTRUCTOR_INSTANTIATION);
1157        return descriptorException;
1158    }
1159
1160    public static DescriptorException nullPointerWhileConstructorInstantiationOfFactory(ClassDescriptor descriptor, Throwable JavaDoc exception) {
1161        Object JavaDoc[] args = { };
1162
1163        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
1164        descriptorException.setErrorCode(NULL_POINTER_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY);
1165        return descriptorException;
1166    }
1167
1168    public static DescriptorException nullPointerWhileGettingValueThruInstanceVariableAccessor(String JavaDoc attributeName, String JavaDoc objectName, Throwable JavaDoc exception) {
1169        Object JavaDoc[] args = { attributeName, objectName };
1170
1171        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR, args));
1172        descriptorException.setInternalException(exception);
1173        descriptorException.setErrorCode(NULL_POINTER_WHILE_GETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR);
1174        return descriptorException;
1175    }
1176
1177    public static DescriptorException nullPointerWhileGettingValueThruMethodAccessor(String JavaDoc methodName, String JavaDoc objectName, Throwable JavaDoc exception) {
1178        Object JavaDoc[] args = { methodName, objectName };
1179
1180        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR, args));
1181        descriptorException.setInternalException(exception);
1182        descriptorException.setErrorCode(NULL_POINTER_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR);
1183        return descriptorException;
1184    }
1185
1186    public static DescriptorException nullPointerWhileMethodInstantiation(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1187        Object JavaDoc[] args = { methodName };
1188
1189        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_METHOD_INSTANTIATION, args), descriptor, exception);
1190        descriptorException.setErrorCode(NULL_POINTER_WHILE_METHOD_INSTANTIATION);
1191        return descriptorException;
1192    }
1193
1194    public static DescriptorException nullPointerWhileMethodInstantiationOfFactory(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1195        Object JavaDoc[] args = { methodName };
1196
1197        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_METHOD_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
1198        descriptorException.setErrorCode(NULL_POINTER_WHILE_METHOD_INSTANTIATION_OF_FACTORY);
1199        return descriptorException;
1200    }
1201
1202    public static DescriptorException nullPointerWhileSettingValueThruInstanceVariableAccessor(String JavaDoc attributeName, Object JavaDoc objectValue, Throwable JavaDoc exception) {
1203        Object JavaDoc[] args = { attributeName, String.valueOf(objectValue) };
1204
1205        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR, args));
1206        descriptorException.setInternalException(exception);
1207        descriptorException.setErrorCode(NULL_POINTER_WHILE_SETTING_VALUE_THRU_INSTANCE_VARIABLE_ACCESSOR);
1208        return descriptorException;
1209    }
1210
1211    public static DescriptorException nullPointerWhileSettingValueThruMethodAccessor(String JavaDoc setMethodName, Object JavaDoc value, Throwable JavaDoc exception) {
1212        Object JavaDoc[] args = { setMethodName, String.valueOf(value) };
1213
1214        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NULL_POINTER_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR, args));
1215        descriptorException.setInternalException(exception);
1216        descriptorException.setErrorCode(NULL_POINTER_WHILE_SETTING_VALUE_THRU_METHOD_ACCESSOR);
1217        return descriptorException;
1218    }
1219
1220    public static DescriptorException onlyOneTableCanBeAddedWithThisMethod(ClassDescriptor descriptor) {
1221        Object JavaDoc[] args = { };
1222
1223        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ONLY_ONE_TABLE_CAN_BE_ADDED_WITH_THIS_METHOD, args), descriptor);
1224        descriptorException.setErrorCode(ONLY_ONE_TABLE_CAN_BE_ADDED_WITH_THIS_METHOD);
1225        return descriptorException;
1226    }
1227
1228    public static DescriptorException parameterAndMappingWithIndirectionMismatch(DatabaseMapping mapping) {
1229        Object JavaDoc[] args = { mapping.getAttributeName() };
1230
1231        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARAMETER_AND_MAPPING_WITH_INDIRECTION_MISMATCH, args), mapping);
1232        exception.setErrorCode(PARAMETER_AND_MAPPING_WITH_INDIRECTION_MISMATCH);
1233        return exception;
1234    }
1235
1236    public static DescriptorException parameterAndMappingWithoutIndirectionMismatch(DatabaseMapping mapping) {
1237        Object JavaDoc[] args = { mapping.getAttributeName() };
1238
1239        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARAMETER_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH, args), mapping);
1240        exception.setErrorCode(PARAMETER_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH);
1241        return exception;
1242    }
1243
1244    public static DescriptorException parameterAndMappingWithTransparentIndirectionMismatch(DatabaseMapping mapping, String JavaDoc validTypeName) {
1245        Object JavaDoc[] args = { mapping.getAttributeName(), validTypeName };
1246
1247        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARAMETER_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH, args), mapping);
1248        exception.setErrorCode(PARAMETER_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH);
1249        return exception;
1250    }
1251
1252    public static DescriptorException parentClassIsSelf(ClassDescriptor descriptor) {
1253        Object JavaDoc[] args = { };
1254
1255        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARENT_CLASS_IS_SELF, args), descriptor);
1256        exception.setErrorCode(PARENT_CLASS_IS_SELF);
1257        return exception;
1258    }
1259
1260    public static DescriptorException parentDescriptorNotSpecified(String JavaDoc parentClassName, ClassDescriptor descriptor) {
1261        Object JavaDoc[] args = { parentClassName };
1262
1263        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARENT_DESCRIPTOR_NOT_SPECIFIED, args), descriptor);
1264        descriptorException.setErrorCode(PARENT_DESCRIPTOR_NOT_SPECIFIED);
1265        return descriptorException;
1266    }
1267
1268    public static DescriptorException primaryKeyFieldsNotSepcified(ClassDescriptor descriptor) {
1269        Object JavaDoc[] args = { };
1270
1271        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PRIMARY_KEY_FIELDS_NOT_SPECIFIED, args), descriptor);
1272        descriptorException.setErrorCode(PRIMARY_KEY_FIELDS_NOT_SPECIFIED);
1273        return descriptorException;
1274    }
1275
1276    public static DescriptorException proxyIndirectionNotAvailable(DatabaseMapping mapping) {
1277        Object JavaDoc[] args = { };
1278
1279        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PROXY_INDIRECTION_NOT_AVAILABLE, args), mapping);
1280        descriptorException.setErrorCode(PROXY_INDIRECTION_NOT_AVAILABLE);
1281        return descriptorException;
1282    }
1283
1284    public static DescriptorException referenceClassNotSpecified(DatabaseMapping mapping) {
1285        Object JavaDoc[] args = { };
1286
1287        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, REFERENCE_CLASS_NOT_SPECIFIED, args), mapping);
1288        descriptorException.setErrorCode(REFERENCE_CLASS_NOT_SPECIFIED);
1289        return descriptorException;
1290    }
1291
1292    public static DescriptorException referenceDescriptorIsNotAggregate(String JavaDoc className, DatabaseMapping mapping) {
1293        Object JavaDoc[] args = { className };
1294
1295        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, REFERENCE_DESCRIPTOR_IS_NOT_AGGREGATE, args), mapping);
1296        descriptorException.setErrorCode(REFERENCE_DESCRIPTOR_IS_NOT_AGGREGATE);
1297        return descriptorException;
1298    }
1299
1300    public static DescriptorException referenceDescriptorCannotBeAggregate(DatabaseMapping mapping) {
1301        DescriptorException descriptorException = new DescriptorException("Reference descriptor cannot be aggregate.", mapping);
1302        descriptorException.setErrorCode(REFERENCE_DESCRIPTOR_CANNOT_BE_AGGREGATE);
1303        return descriptorException;
1304    }
1305
1306    public static DescriptorException referenceDescriptorIsNotAggregateCollection(String JavaDoc className, DatabaseMapping mapping) {
1307        Object JavaDoc[] args = { className };
1308
1309        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, REFERENCE_DESCRIPTOR_IS_NOT_AGGREGATECOLLECTION, args), mapping);
1310        descriptorException.setErrorCode(REFERENCE_DESCRIPTOR_IS_NOT_AGGREGATECOLLECTION);
1311        return descriptorException;
1312    }
1313
1314    public static DescriptorException referenceKeyFieldNotProperlySpecified(DatabaseField field, ForeignReferenceMapping mapping) {
1315        Object JavaDoc[] args = { field };
1316
1317        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, REFERENCE_KEY_FIELD_NOT_PROPERLY_SPECIFIED, args), mapping);
1318        descriptorException.setErrorCode(REFERENCE_KEY_FIELD_NOT_PROPERLY_SPECIFIED);
1319        return descriptorException;
1320    }
1321
1322    public static DescriptorException referenceTableNotSpecified(DatabaseMapping mapping) {
1323        Object JavaDoc[] args = { };
1324
1325        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, REFERENCE_TABLE_NOT_SPECIFIED, args), mapping);
1326        descriptorException.setErrorCode(REFERENCE_TABLE_NOT_SPECIFIED);
1327        return descriptorException;
1328    }
1329
1330    public static DescriptorException relationKeyFieldNotProperlySpecified(DatabaseField field, ForeignReferenceMapping mapping) {
1331        Object JavaDoc[] args = { field };
1332
1333        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RELATION_KEY_FIELD_NOT_PROPERLY_SPECIFIED, args), mapping);
1334        descriptorException.setErrorCode(RELATION_KEY_FIELD_NOT_PROPERLY_SPECIFIED);
1335        return descriptorException;
1336    }
1337
1338    public static DescriptorException returnAndMappingWithIndirectionMismatch(DatabaseMapping mapping) {
1339        Object JavaDoc[] args = { mapping.getAttributeName() };
1340
1341        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_AND_MAPPING_WITH_INDIRECTION_MISMATCH, args), mapping);
1342        exception.setErrorCode(RETURN_AND_MAPPING_WITH_INDIRECTION_MISMATCH);
1343        return exception;
1344    }
1345
1346    public static DescriptorException returnAndMappingWithoutIndirectionMismatch(DatabaseMapping mapping) {
1347        Object JavaDoc[] args = { mapping.getAttributeName() };
1348
1349        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH, args), mapping);
1350        exception.setErrorCode(RETURN_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH);
1351        return exception;
1352    }
1353
1354    public static DescriptorException returnAndMappingWithTransparentIndirectionMismatch(DatabaseMapping mapping, String JavaDoc validTypeName) {
1355        Object JavaDoc[] args = { mapping.getAttributeName(), validTypeName };
1356
1357        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH, args), mapping);
1358        exception.setErrorCode(RETURN_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH);
1359        return exception;
1360    }
1361
1362    public static DescriptorException returnTypeInGetAttributeAccessor(String JavaDoc attributeMethodName, DatabaseMapping mapping) {
1363        Object JavaDoc[] args = { attributeMethodName };
1364
1365        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_TYPE_IN_GET_ATTRIBUTE_ACCESSOR, args));
1366        descriptorException.setErrorCode(RETURN_TYPE_IN_GET_ATTRIBUTE_ACCESSOR);
1367        descriptorException.setMapping(mapping);
1368        return descriptorException;
1369    }
1370
1371    public static DescriptorException securityOnFindMethod(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1372        Object JavaDoc[] args = { methodName };
1373
1374        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_ON_FIND_METHOD, args), descriptor, exception);
1375        descriptorException.setErrorCode(SECURITY_ON_FIND_METHOD);
1376        return descriptorException;
1377    }
1378
1379    public static DescriptorException securityOnFindObsoleteMethod(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1380        Object JavaDoc[] args = { methodName };
1381
1382        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_ON_FIND_OBSOLETE_METHOD, args), descriptor, exception);
1383        descriptorException.setErrorCode(SECURITY_ON_FIND_OBSOLETE_METHOD);
1384        return descriptorException;
1385    }
1386
1387    public static DescriptorException securityOnInitializingAttributeMethod(String JavaDoc attributeMethodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
1388        Object JavaDoc[] args = { attributeMethodName };
1389
1390        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_ON_INITIALIZING_ATTRIBUTE_METHOD, args));
1391        descriptorException.setErrorCode(SECURITY_ON_INITIALIZING_ATTRIBUTE_METHOD);
1392        descriptorException.setMapping(mapping);
1393        descriptorException.setInternalException(exception);
1394        return descriptorException;
1395    }
1396
1397    public static DescriptorException securityWhileConvertingToMethod(String JavaDoc methodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
1398        Object JavaDoc[] args = { methodName };
1399
1400        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_WHILE_CONVERTING_TO_METHOD, args));
1401        descriptorException.setErrorCode(SECURITY_WHILE_CONVERTING_TO_METHOD);
1402        descriptorException.setMapping(mapping);
1403        descriptorException.setInternalException(exception);
1404        return descriptorException;
1405    }
1406
1407    public static DescriptorException securityWhileInitializingAttributesInInstanceVariableAccessor(String JavaDoc attributeName, String JavaDoc javaClassName, Throwable JavaDoc exception) {
1408        Object JavaDoc[] args = { attributeName, javaClassName };
1409
1410        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_WHILE_INITIALIZING_ATTRIBUTES_IN_INSTANCE_VARIABLE_ACCESSOR, args));
1411        descriptorException.setErrorCode(SECURITY_WHILE_INITIALIZING_ATTRIBUTES_IN_INSTANCE_VARIABLE_ACCESSOR);
1412        descriptorException.setInternalException(exception);
1413        return descriptorException;
1414    }
1415
1416    public static DescriptorException securityWhileInitializingAttributesInMethodAccessor(String JavaDoc setMethodName, String JavaDoc getMethodName, String JavaDoc javaClassName) {
1417        Object JavaDoc[] args = { setMethodName, getMethodName, javaClassName };
1418
1419        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_WHILE_INITIALIZING_ATTRIBUTES_IN_METHOD_ACCESSOR, args));
1420        descriptorException.setErrorCode(SECURITY_WHILE_INITIALIZING_ATTRIBUTES_IN_METHOD_ACCESSOR);
1421        return descriptorException;
1422    }
1423
1424    public static DescriptorException securityWhileInitializingClassExtractionMethod(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1425        Object JavaDoc[] args = { methodName };
1426
1427        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_WHILE_INITIALIZING_CLASS_EXTRACTION_METHOD, args), descriptor, exception);
1428        descriptorException.setErrorCode(SECURITY_WHILE_INITIALIZING_CLASS_EXTRACTION_METHOD);
1429        return descriptorException;
1430    }
1431
1432    public static DescriptorException classExtractionMethodMustBeStatic(String JavaDoc methodName, ClassDescriptor descriptor) {
1433        Object JavaDoc[] args = { methodName };
1434
1435        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, CLASS_EXTRACTION_METHOD_MUST_BE_STATIC, args), descriptor);
1436        descriptorException.setErrorCode(CLASS_EXTRACTION_METHOD_MUST_BE_STATIC);
1437        return descriptorException;
1438    }
1439
1440    public static DescriptorException securityWhileInitializingCopyPolicy(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1441        Object JavaDoc[] args = { methodName };
1442
1443        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_WHILE_INITIALIZING_COPY_POLICY, args), descriptor, exception);
1444        descriptorException.setErrorCode(SECURITY_WHILE_INITIALIZING_COPY_POLICY);
1445        return descriptorException;
1446    }
1447
1448    public static DescriptorException securityWhileInitializingInstantiationPolicy(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1449        Object JavaDoc[] args = { methodName };
1450
1451        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SECURITY_WHILE_INITIALIZING_INSTANTIATION_POLICY, args), descriptor, exception);
1452        descriptorException.setErrorCode(SECURITY_WHILE_INITIALIZING_INSTANTIATION_POLICY);
1453        return descriptorException;
1454    }
1455
1456    public static DescriptorException sequenceNumberPropertyNotSpecified(ClassDescriptor descriptor) {
1457        Object JavaDoc[] args = { };
1458
1459        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SEQUENCE_NUMBER_PROPERTY_NOT_SPECIFIED, args), descriptor);
1460        descriptorException.setErrorCode(SEQUENCE_NUMBER_PROPERTY_NOT_SPECIFIED);
1461        return descriptorException;
1462    }
1463
1464    /**
1465     * INTERNAL:
1466     * Set the mapping.
1467     */

1468    public void setDescriptor(ClassDescriptor descriptor) {
1469        this.descriptor = descriptor;
1470    }
1471
1472    public static DescriptorException setExistenceCheckingNotUnderstood(String JavaDoc token, ClassDescriptor descriptor) {
1473        Object JavaDoc[] args = { token };
1474
1475        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SET_EXISTENCE_CHECKING_NOT_UNDERSTOOD, args), descriptor);
1476        descriptorException.setErrorCode(SET_EXISTENCE_CHECKING_NOT_UNDERSTOOD);
1477        return descriptorException;
1478    }
1479
1480    /**
1481     * INTERNAL:
1482     * Set the mapping.
1483     */

1484    public void setMapping(DatabaseMapping mapping) {
1485        if (mapping != null) {
1486            this.mapping = mapping;
1487            setDescriptor(mapping.getDescriptor());
1488        }
1489    }
1490
1491    public static DescriptorException setMethodParameterTypeNotValid(CollectionMapping mapping) {
1492        Object JavaDoc[] args = { mapping.getAttributeName() };
1493
1494        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SET_METHOD_PARAMETER_TYPE_NOT_VALID, args), mapping);
1495        exception.setErrorCode(SET_METHOD_PARAMETER_TYPE_NOT_VALID);
1496        return exception;
1497    }
1498
1499    public static DescriptorException sizeMismatchOfForeignKeys(ForeignReferenceMapping mapping) {
1500        Object JavaDoc[] args = { };
1501
1502        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, SIZE_MISMATCH_OF_FOREIGN_KEYS, args), mapping);
1503        descriptorException.setErrorCode(SIZE_MISMATCH_OF_FOREIGN_KEYS);
1504        return descriptorException;
1505    }
1506
1507    public static DescriptorException structureNameNotSetInMapping(DatabaseMapping mapping) {
1508        Object JavaDoc[] args = { };
1509
1510        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, STRUCTURE_NAME_NOT_SET_IN_MAPPING, args), mapping);
1511        descriptorException.setErrorCode(STRUCTURE_NAME_NOT_SET_IN_MAPPING);
1512        return descriptorException;
1513    }
1514
1515    public static DescriptorException tableIsNotPresentInDatabase(ClassDescriptor descriptor) {
1516        Object JavaDoc[] args = { descriptor.getTableName() };
1517
1518        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TABLE_IS_NOT_PRESENT_IN_DATABASE, args), descriptor);
1519        descriptorException.setErrorCode(TABLE_IS_NOT_PRESENT_IN_DATABASE);
1520        return descriptorException;
1521    }
1522
1523    public static DescriptorException tableNotPresent(String JavaDoc tableName, ClassDescriptor descriptor) {
1524        Object JavaDoc[] args = { tableName };
1525
1526        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TABLE_NOT_PRESENT, args), descriptor);
1527        descriptorException.setErrorCode(TABLE_NOT_PRESENT);
1528        return descriptorException;
1529    }
1530
1531    public static DescriptorException tableNotSpecified(ClassDescriptor descriptor) {
1532        Object JavaDoc[] args = { };
1533
1534        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TABLE_NOT_SPECIFIED, args), descriptor);
1535        descriptorException.setErrorCode(TABLE_NOT_SPECIFIED);
1536        return descriptorException;
1537    }
1538
1539    public static DescriptorException targetForeignKeysSizeMismatch(ForeignReferenceMapping mapping) {
1540        Object JavaDoc[] args = { };
1541
1542        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_FOREIGN_KEYS_SIZE_MISMATCH, args), mapping);
1543        descriptorException.setErrorCode(TARGET_FOREIGN_KEYS_SIZE_MISMATCH);
1544        return descriptorException;
1545    }
1546
1547    public static DescriptorException targetInvocationWhileCloning(Object JavaDoc domainObject, String JavaDoc methodName, ClassDescriptor descriptor, Throwable JavaDoc exception) {
1548        Object JavaDoc[] args = { domainObject, methodName };
1549
1550        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_CLONING, args), descriptor, exception);
1551        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_CLONING);
1552        return descriptorException;
1553    }
1554
1555    public static DescriptorException targetInvocationWhileConstructorInstantiation(ClassDescriptor descriptor, Exception JavaDoc exception) {
1556        Object JavaDoc[] args = { };
1557
1558        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_CONSTRUCTOR_INSTANTIATION, args), descriptor, exception);
1559        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_CONSTRUCTOR_INSTANTIATION);
1560        return descriptorException;
1561    }
1562
1563    public static DescriptorException targetInvocationWhileConstructorInstantiationOfFactory(ClassDescriptor descriptor, Exception JavaDoc exception) {
1564        Object JavaDoc[] args = { };
1565
1566        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
1567        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_CONSTRUCTOR_INSTANTIATION_OF_FACTORY);
1568        return descriptorException;
1569    }
1570
1571    public static DescriptorException targetInvocationWhileEventExecution(String JavaDoc eventMethodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1572        Object JavaDoc[] args = { eventMethodName };
1573
1574        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_EVENT_EXECUTION, args), descriptor, exception);
1575        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_EVENT_EXECUTION);
1576        return descriptorException;
1577    }
1578
1579    public static DescriptorException targetInvocationWhileGettingValueThruMethodAccessor(String JavaDoc methodName, String JavaDoc objectName, Throwable JavaDoc exception) {
1580        Object JavaDoc[] args = { methodName, objectName };
1581
1582        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR, args));
1583        descriptorException.setInternalException(exception);
1584        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_GETTING_VALUE_THRU_METHOD_ACCESSOR);
1585        return descriptorException;
1586    }
1587
1588    public static DescriptorException targetInvocationWhileInstantiatingMethodBasedProxy(Throwable JavaDoc exception) {
1589        Object JavaDoc[] args = { };
1590
1591        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_INSTANTIATING_METHOD_BASED_PROXY, args));
1592        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_INSTANTIATING_METHOD_BASED_PROXY);
1593        descriptorException.setInternalException(exception);
1594        return descriptorException;
1595    }
1596
1597    public static DescriptorException targetInvocationWhileInvokingAttributeMethod(DatabaseMapping mapping, Throwable JavaDoc exception) {
1598        Object JavaDoc[] args = { };
1599
1600        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_INVOKING_ATTRIBUTE_METHOD, args));
1601        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_INVOKING_ATTRIBUTE_METHOD);
1602        descriptorException.setInternalException(exception);
1603        descriptorException.setMapping(mapping);
1604        return descriptorException;
1605    }
1606
1607    public static DescriptorException targetInvocationWhileInvokingFieldToMethod(String JavaDoc methodName, DatabaseMapping mapping, Throwable JavaDoc exception) {
1608        Object JavaDoc[] args = { methodName };
1609
1610        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_INVOKING_FIELD_TO_METHOD, args));
1611        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_INVOKING_FIELD_TO_METHOD);
1612        descriptorException.setInternalException(exception);
1613        descriptorException.setMapping(mapping);
1614        return descriptorException;
1615    }
1616
1617    public static DescriptorException targetInvocationWhileInvokingRowExtractionMethod(AbstractRecord row, Method method, ClassDescriptor descriptor, Throwable JavaDoc exception) {
1618        Object JavaDoc[] args = { row, method };
1619
1620        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_INVOKING_ROW_EXTRACTION_METHOD, args), descriptor, exception);
1621        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_INVOKING_ROW_EXTRACTION_METHOD);
1622        return descriptorException;
1623    }
1624
1625    public static DescriptorException targetInvocationWhileMethodInstantiation(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1626        Object JavaDoc[] args = { methodName };
1627
1628        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_METHOD_INSTANTIATION, args), descriptor, exception);
1629        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_METHOD_INSTANTIATION);
1630        return descriptorException;
1631    }
1632
1633    public static DescriptorException targetInvocationWhileMethodInstantiationOfFactory(String JavaDoc methodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1634        Object JavaDoc[] args = { methodName };
1635
1636        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_METHOD_INSTANTIATION_OF_FACTORY, args), descriptor, exception);
1637        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_METHOD_INSTANTIATION_OF_FACTORY);
1638        return descriptorException;
1639    }
1640
1641    public static DescriptorException targetInvocationWhileObsoleteEventExecute(String JavaDoc eventMethodName, ClassDescriptor descriptor, Exception JavaDoc exception) {
1642        Object JavaDoc[] args = { eventMethodName };
1643
1644        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_OBSOLETE_EVENT_EXECUTION, args), descriptor, exception);
1645        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_OBSOLETE_EVENT_EXECUTION);
1646        return descriptorException;
1647    }
1648
1649    public static DescriptorException targetInvocationWhileSettingValueThruMethodAccessor(String JavaDoc setMethodName, Object JavaDoc value, Throwable JavaDoc exception) {
1650        Object JavaDoc[] args = { setMethodName, String.valueOf(value), CR };
1651
1652        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, TARGET_INVOCATION_WHILE_SETTING_VALUE_THRU_METHOD_ACESSOR, args));
1653        descriptorException.setInternalException(exception);
1654        descriptorException.setErrorCode(TARGET_INVOCATION_WHILE_SETTING_VALUE_THRU_METHOD_ACESSOR);
1655        return descriptorException;
1656    }
1657
1658    // Bug 2618982
1659
public static DescriptorException unsupportedTypeForBidirectionalRelationshipMaintenance(DatabaseMapping mapping, oracle.toplink.essentials.internal.queryframework.ContainerPolicy containerPolicy) {
1660        Object JavaDoc[] args = { mapping.getAttributeName(), containerPolicy };
1661        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, UNSUPPORTED_TYPE_FOR_BIDIRECTIONAL_RELATIONSHIP_MAINTENANCE, args), mapping);
1662        exception.setErrorCode(UNSUPPORTED_TYPE_FOR_BIDIRECTIONAL_RELATIONSHIP_MAINTENANCE);
1663        return exception;
1664    }
1665
1666    public static DescriptorException valueHolderInstantiationMismatch(Object JavaDoc attributeValue, DatabaseMapping mapping) {
1667        Object JavaDoc[] args = { mapping.getAttributeName(), attributeValue };
1668
1669        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, VALUE_HOLDER_INSTANTIATION_MISMATCH, args), mapping);
1670        exception.setErrorCode(VALUE_HOLDER_INSTANTIATION_MISMATCH);
1671        return exception;
1672    }
1673
1674    public static DescriptorException valueNotFoundInClassIndicatorMapping(ClassDescriptor parentDescriptor, ClassDescriptor descriptor) {
1675        Object JavaDoc[] args = { parentDescriptor };
1676
1677        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, VALUE_NOT_FOUND_IN_CLASS_INDICATOR_MAPPING, args), descriptor);
1678        descriptorException.setErrorCode(VALUE_NOT_FOUND_IN_CLASS_INDICATOR_MAPPING);
1679        return descriptorException;
1680    }
1681
1682    public static DescriptorException variableOneToOneMappingIsNotDefinedProperly(DatabaseMapping mapping, ClassDescriptor descriptor, String JavaDoc targetKeyName) {
1683        Object JavaDoc[] args = { targetKeyName };
1684
1685        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, VARIABLE_ONE_TO_ONE_MAPPING_IS_NOT_DEFINED, args), mapping);
1686        descriptorException.setErrorCode(VARIABLE_ONE_TO_ONE_MAPPING_IS_NOT_DEFINED);
1687        return descriptorException;
1688    }
1689
1690    public static DescriptorException writeLockFieldInChildDescriptor(ClassDescriptor descriptor) {
1691        Object JavaDoc[] args = { };
1692
1693        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, WRITE_LOCK_FIELD_IN_CHILD_DESCRIPTOR, args), descriptor);
1694        descriptorException.setErrorCode(WRITE_LOCK_FIELD_IN_CHILD_DESCRIPTOR);
1695        return descriptorException;
1696    }
1697
1698    public static DescriptorException mappingForAttributeIsMissing(String JavaDoc attributeName, ClassDescriptor descriptor) {
1699        Object JavaDoc[] args = { attributeName };
1700
1701        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_MAPPING_FOR_ATTRIBUTENAME, args), descriptor);
1702        descriptorException.setErrorCode(NO_MAPPING_FOR_ATTRIBUTENAME);
1703        return descriptorException;
1704    }
1705
1706    public static DescriptorException attributeMappingIsMissingForEntityBean(String JavaDoc attributeName, String JavaDoc beanName) {
1707        Object JavaDoc[] args = { attributeName, beanName };
1708
1709        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_MAPPING_FOR_ATTRIBUTENAME_IN_ENTITY_BEAN, args));
1710        descriptorException.setErrorCode(NO_MAPPING_FOR_ATTRIBUTENAME_IN_ENTITY_BEAN);
1711        return descriptorException;
1712    }
1713
1714    public static DescriptorException returningPolicyFieldTypeConflict(String JavaDoc fieldName, String JavaDoc type1Name, String JavaDoc type2Name, ClassDescriptor descriptor) {
1715        Object JavaDoc[] args = { fieldName, type1Name, type2Name };
1716
1717        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_FIELD_TYPE_CONFLICT, args), descriptor);
1718        descriptorException.setErrorCode(RETURNING_POLICY_FIELD_TYPE_CONFLICT);
1719        return descriptorException;
1720    }
1721
1722    public static DescriptorException returningPolicyFieldInsertConflict(String JavaDoc fieldName, ClassDescriptor descriptor) {
1723        Object JavaDoc[] args = { fieldName };
1724
1725        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_FIELD_INSERT_CONFLICT, args), descriptor);
1726        descriptorException.setErrorCode(RETURNING_POLICY_FIELD_INSERT_CONFLICT);
1727        return descriptorException;
1728    }
1729
1730    public static DescriptorException returningPolicyAndDescriptorFieldTypeConflict(String JavaDoc fieldName, String JavaDoc returningPolicyFieldTypeName, String JavaDoc descriptorFieldTypeName, ClassDescriptor descriptor) {
1731        Object JavaDoc[] args = { fieldName, returningPolicyFieldTypeName, descriptorFieldTypeName };
1732
1733        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_AND_DESCRIPTOR_FIELD_TYPE_CONFLICT, args), descriptor);
1734        descriptorException.setErrorCode(RETURNING_POLICY_AND_DESCRIPTOR_FIELD_TYPE_CONFLICT);
1735        return descriptorException;
1736    }
1737
1738    public static DescriptorException returningPolicyUnmappedFieldTypeNotSet(String JavaDoc fieldName, ClassDescriptor descriptor) {
1739        Object JavaDoc[] args = { fieldName };
1740
1741        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_UNMAPPED_FIELD_TYPE_NOT_SET, args), descriptor);
1742        descriptorException.setErrorCode(RETURNING_POLICY_UNMAPPED_FIELD_TYPE_NOT_SET);
1743        return descriptorException;
1744    }
1745
1746    public static DescriptorException returningPolicyMappedFieldTypeNotSet(String JavaDoc fieldName, ClassDescriptor descriptor) {
1747        Object JavaDoc[] args = { fieldName };
1748
1749        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_MAPPED_FIELD_TYPE_NOT_SET, args), descriptor);
1750        descriptorException.setErrorCode(RETURNING_POLICY_MAPPED_FIELD_TYPE_NOT_SET);
1751        return descriptorException;
1752    }
1753
1754    public static DescriptorException returningPolicyMappingNotSupported(String JavaDoc fieldName, String JavaDoc mappingClassName, DatabaseMapping mapping) {
1755        Object JavaDoc[] args = { fieldName, mappingClassName };
1756
1757        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_MAPPING_NOT_SUPPORTED, args), mapping);
1758        descriptorException.setErrorCode(RETURNING_POLICY_MAPPING_NOT_SUPPORTED);
1759        return descriptorException;
1760    }
1761
1762    public static DescriptorException returningPolicyFieldNotSupported(String JavaDoc fieldName, ClassDescriptor descriptor) {
1763        Object JavaDoc[] args = { fieldName };
1764
1765        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURNING_POLICY_FIELD_NOT_SUPPORTED, args), descriptor);
1766        descriptorException.setErrorCode(RETURNING_POLICY_FIELD_NOT_SUPPORTED);
1767        return descriptorException;
1768    }
1769
1770    public static DescriptorException customQueryAndReturningPolicyFieldConflict(String JavaDoc queryTypeName, String JavaDoc fieldName, ClassDescriptor descriptor) {
1771        Object JavaDoc[] args = { queryTypeName, fieldName };
1772
1773        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, CUSTOM_QUERY_AND_RETURNING_POLICY_CONFLICT, args), descriptor);
1774        descriptorException.setErrorCode(CUSTOM_QUERY_AND_RETURNING_POLICY_CONFLICT);
1775        return descriptorException;
1776    }
1777
1778    public static DescriptorException noCustomQueryForReturningPolicy(String JavaDoc queryTypeName, String JavaDoc platformTypeName, ClassDescriptor descriptor) {
1779        Object JavaDoc[] args = { queryTypeName, platformTypeName };
1780
1781        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NO_CUSTOM_QUERY_FOR_RETURNING_POLICY, args), descriptor);
1782        descriptorException.setErrorCode(NO_CUSTOM_QUERY_FOR_RETURNING_POLICY);
1783        return descriptorException;
1784    }
1785
1786    public static DescriptorException updateAllFieldsNotSet(ClassDescriptor descriptor) {
1787        Object JavaDoc[] args = { };
1788
1789        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, UPDATE_ALL_FIELDS_NOT_SET, args), descriptor);
1790        descriptorException.setErrorCode(UPDATE_ALL_FIELDS_NOT_SET);
1791        return descriptorException;
1792    }
1793
1794    public static DescriptorException invalidMappingType(DatabaseMapping mapping) {
1795        Object JavaDoc[] args = { mapping.getAttributeName() };
1796
1797        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_MAPPING_TYPE, args), mapping);
1798        descriptorException.setErrorCode(INVALID_MAPPING_TYPE);
1799        return descriptorException;
1800    }
1801
1802    public static DescriptorException needToImplementChangeTracker(ClassDescriptor descriptor) {
1803        Object JavaDoc[] args = { descriptor.getJavaClass() };
1804
1805        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NEED_TO_IMPLEMENT_CHANGETRACKER, args), descriptor);
1806        descriptorException.setErrorCode(NEED_TO_IMPLEMENT_CHANGETRACKER);
1807        return descriptorException;
1808    }
1809
1810    public static DescriptorException needToImplementFetchGroupTracker(Class JavaDoc aClass, ClassDescriptor descriptor) {
1811        Object JavaDoc[] args = { aClass };
1812
1813        DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, NEED_TO_IMPLEMENT_FETCHGROUPTRACKER, args), descriptor);
1814        descriptorException.setErrorCode(NEED_TO_IMPLEMENT_FETCHGROUPTRACKER);
1815        return descriptorException;
1816    }
1817
1818    public static DescriptorException errorUsingPrimaryKey(Object JavaDoc primaryKey, ClassDescriptor descriptor, Exception JavaDoc underlying) {
1819        Object JavaDoc[] args = { String.valueOf(INTERNAL_ERROR_ACCESSING_PKFIELD), primaryKey };
1820
1821        DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INTERNAL_ERROR_ACCESSING_PKFIELD, args), descriptor, underlying);
1822        JavaPlatform.setExceptionCause(exception, underlying);
1823        return exception;
1824    }
1825}
1826
Popular Tags