001: /**********************************************************************
002: Copyright (c) 2004 Erik Bengtson and others. All rights reserved.
003: Licensed under the Apache License, Version 2.0 (the "License");
004: you may not use this file except in compliance with the License.
005: You may obtain a copy of the License at
006:
007: http://www.apache.org/licenses/LICENSE-2.0
008:
009: Unless required by applicable law or agreed to in writing, software
010: distributed under the License is distributed on an "AS IS" BASIS,
011: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: See the License for the specific language governing permissions and
013: limitations under the License.
014:
015:
016: Contributors:
017: ...
018: **********************************************************************/package org.jpox.store.mapping;
019:
020: import org.jpox.ClassLoaderResolver;
021: import org.jpox.ObjectManager;
022: import org.jpox.StateManager;
023: import org.jpox.exceptions.JPOXException;
024: import org.jpox.metadata.AbstractMemberMetaData;
025: import org.jpox.store.DatastoreAdapter;
026: import org.jpox.store.DatastoreContainerObject;
027: import org.jpox.store.expression.QueryExpression;
028: import org.jpox.store.expression.ScalarExpression;
029: import org.jpox.store.expression.LogicSetExpression;
030: import org.jpox.util.Localiser;
031:
032: /**
033: * Representation of the mapping of a Java type.
034: * The java type maps to one or more datastore mappings. This means that a field
035: * in a java class can be mapped to many columns in a table (in an RDBMS).
036: * A JavaTypeMapping can exist in 2 forms
037: * <ul>
038: * <li>Constructed for the java type on its own to represent a literal in a JDOQL query, and consequently has
039: * no metadata/container information</li>
040: * <li>Constructed for a field managed by a datastore container, and so has metadata/container information</li>
041: * </ul>
042: *
043: * @version $Revision: 1.33 $
044: **/
045: public abstract class JavaTypeMapping {
046: /** Localiser for messages */
047: protected static final Localiser LOCALISER = Localiser
048: .getInstance("org.jpox.store.Localisation");
049:
050: /** Role signifying that the mapping is for a field in the primary class table */
051: public static final int MAPPING_FIELD = 0;
052:
053: /** Role signifying that the mapping is for a collection element in a join table */
054: public static final int MAPPING_COLLECTION_ELEMENT = 1;
055:
056: /** Role signifying that the mapping is for an array element in a join table */
057: public static final int MAPPING_ARRAY_ELEMENT = 2;
058:
059: /** Role signifying that the mapping is for a map key in a join table */
060: public static final int MAPPING_MAP_KEY = 3;
061:
062: /** Role signifying that the mapping is for a value in a join table */
063: public static final int MAPPING_MAP_VALUE = 4;
064:
065: /**
066: * The field definition, when the type relates specifically to a field.
067: * When this mapping is for a query literal then the metadata will be null.
068: */
069: protected AbstractMemberMetaData fmd;
070:
071: /**
072: * Role of the mapping for the field. Whether it is for the field as a whole, or element of
073: * a collection field (in a join table), or key/value of a map field (in a join table).
074: */
075: protected int roleForField = MAPPING_FIELD;
076:
077: /** The Datastore mappings for this Java type. */
078: protected DatastoreMapping[] datastoreMappings = new DatastoreMapping[0];
079:
080: /** The Datastore Container storing this mapping. */
081: protected DatastoreContainerObject datastoreContainer;
082:
083: /** Adapter for the datastore being used. */
084: protected DatastoreAdapter dba;
085:
086: /** Actual type being mapped */
087: protected String type;
088:
089: /**
090: * Mapping of the reference on the end of the association - Only used when this mapping does not
091: * have datastore fields, but the other side of the association has
092: */
093: protected JavaTypeMapping referenceMapping;
094:
095: /**
096: * Create a new empty JavaTypeMapping.
097: * The caller must call one of the initialize methods to initialize the instance with the DatastoreAdapter
098: * and its type.
099: * <p>
100: * The combination of this empty constructor and one of the initialize method is used instead of parameterized
101: * constructors for efficientcy purpose, both in execution time and code maintainability.
102: * See MappingFactory for how they are used.
103: * </p>
104: * <p>
105: * Concrete subclasses must have a public accesstable empty constructor.
106: * </p>
107: */
108: protected JavaTypeMapping() {
109: }
110:
111: /**
112: * Create a new Mapping with the given DatastoreAdapter for the given type.
113: * @param dba The Datastore Adapter that this Mapping should use.
114: * @param type The Class that this mapping maps to the database.
115: * @param fmd FieldMetaData for the field to be mapped (if any)
116: * @param container The datastore container storing this mapping (if any)
117: */
118: protected JavaTypeMapping(DatastoreAdapter dba, String type,
119: AbstractMemberMetaData fmd,
120: DatastoreContainerObject container) {
121: this .dba = dba;
122: this .type = type;
123: this .fmd = fmd;
124: this .datastoreContainer = container;
125: }
126:
127: /**
128: * Initialize this JavaTypeMapping with the given DatastoreAdapter for the given type.
129: * This will not set the "fmd" and "datastoreContainer" parameters. If these are required for
130: * usage of the mapping then you should call
131: * "setFieldInformation(AbstractMemberMetaData, DatastoreContainerObject)" below
132: * @param dba The Datastore Adapter that this Mapping should use.
133: * @param type The Class that this mapping maps to the database.
134: * @see MappingFactory#createMapping(Class, DatastoreAdapter, String)
135: */
136: public void initialize(DatastoreAdapter dba, String type) {
137: this .dba = dba;
138: this .type = type;
139: }
140:
141: /**
142: * Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.
143: * Subclasses should override this method to perform any datastore initialization operations.
144: * @param dba The Datastore Adapter that this Mapping should use.
145: * @param fmd FieldMetaData for the field to be mapped (if any)
146: * @param container The datastore container storing this mapping (if any)
147: * @param clr the ClassLoaderResolver
148: */
149: public void initialize(DatastoreAdapter dba,
150: AbstractMemberMetaData fmd,
151: DatastoreContainerObject container, ClassLoaderResolver clr) {
152: this .dba = dba;
153: this .fmd = fmd;
154: this .type = fmd.getType().getName();
155: this .datastoreContainer = container;
156: }
157:
158: /**
159: * Convenience method for use where the mapping was created for a particular type
160: * (using the initialize(DatastoreAdapter, String) and we now have the field that it applies for.
161: * @param fmd Field MetaData
162: * @param container Container (table) that the mapping is for
163: */
164: public void setFieldInformation(AbstractMemberMetaData fmd,
165: DatastoreContainerObject container) {
166: this .fmd = fmd;
167: this .datastoreContainer = container;
168: }
169:
170: /**
171: * Method to set the role for the field.
172: * Should be called before initialize().
173: * @param role Role for field.
174: */
175: public void setRoleForField(int role) {
176: roleForField = role;
177: }
178:
179: /**
180: * Convenience method to return if the (part of the) field being represented by this mapping is serialised.
181: * @return Whether to use Java serialisation
182: */
183: public boolean isSerialised() {
184: if (roleForField == MAPPING_FIELD) {
185: return (fmd != null ? fmd.isSerialized() : false);
186: } else if (roleForField == MAPPING_COLLECTION_ELEMENT) {
187: if (fmd == null) {
188: return false;
189: }
190: return (fmd.getCollection() != null ? fmd.getCollection()
191: .isSerializedElement() : false);
192: } else if (roleForField == MAPPING_ARRAY_ELEMENT) {
193: if (fmd == null) {
194: return false;
195: }
196: return (fmd.getArray() != null ? fmd.getArray()
197: .isSerializedElement() : false);
198: } else if (roleForField == MAPPING_MAP_KEY) {
199: if (fmd == null) {
200: return false;
201: }
202: return (fmd.getMap() != null ? fmd.getMap()
203: .isSerializedKey() : false);
204: } else if (roleForField == MAPPING_MAP_VALUE) {
205: if (fmd == null) {
206: return false;
207: }
208: return (fmd.getMap() != null ? fmd.getMap()
209: .isSerializedValue() : false);
210: }
211: return false;
212: }
213:
214: /**
215: * Accessor for whether this mapping is nullable
216: * @return Whether it is nullable
217: */
218: public boolean isNullable() {
219: for (int i = 0; i < datastoreMappings.length; i++) {
220: if (!datastoreMappings[i].isNullable()) {
221: return false;
222: }
223: }
224: return true;
225: }
226:
227: /**
228: * Accessor for the datastore mappings for this java type
229: * @return The datastore mapping(s)
230: */
231: public DatastoreMapping[] getDataStoreMappings() {
232: return datastoreMappings;
233: }
234:
235: /**
236: * Accessor for the datastore class (e.g in an RDBMS context, the Table).
237: * Will be null if this mapping is for a literal in a query.
238: * @return The datastore class containing this mapped field.
239: */
240: public DatastoreContainerObject getDatastoreContainer() {
241: return datastoreContainer;
242: }
243:
244: /**
245: * Accessor for a datastore mapping
246: * @param index The id of the mapping
247: * @return The datastore mapping
248: */
249: public DatastoreMapping getDataStoreMapping(int index) {
250: return datastoreMappings[index];
251: }
252:
253: /**
254: * Accessor for the mapping at the other end of a relation when this field is
255: * part of a 1-1, 1-N, M-N relation. Will be null otherwise.
256: * @return The mapping at the other end.
257: */
258: public JavaTypeMapping getReferenceMapping() {
259: return referenceMapping;
260: }
261:
262: /**
263: * Method to set the mapping at the other end of the relation.
264: * Not to be used when this field is not part of a relation.
265: * @param referenceMapping The mapping at the other end
266: */
267: public void setReferenceMapping(JavaTypeMapping referenceMapping) {
268: this .referenceMapping = referenceMapping;
269: }
270:
271: /**
272: * Method to add a datastore mapping
273: * @param datastoreMapping The datastore mapping
274: */
275: public void addDataStoreMapping(DatastoreMapping datastoreMapping) {
276: DatastoreMapping[] dm = datastoreMappings;
277: datastoreMappings = new DatastoreMapping[datastoreMappings.length + 1];
278: System.arraycopy(dm, 0, datastoreMappings, 0, dm.length);
279: datastoreMappings[dm.length] = datastoreMapping;
280: }
281:
282: /**
283: * Acessor for the number of datastore fields (e.g. RDBMS number of columns)
284: * @return the number of datastore fields
285: */
286: public int getNumberOfDatastoreFields() {
287: return datastoreMappings.length;
288: }
289:
290: /**
291: * Accessor for the FieldMetaData of the field to be mapped.
292: * Will be null if this mapping is for a literal in a query.
293: * @return Returns the FieldMetaData.
294: */
295: public AbstractMemberMetaData getFieldMetaData() {
296: return fmd;
297: }
298:
299: /**
300: * Accessor for the role of the is mapping for the field.
301: * @return Role of this mapping for the field
302: */
303: public int getRoleForField() {
304: return roleForField;
305: }
306:
307: /**
308: * Accessor for the java type being mapped.
309: * This is the java type that the mapping represents. Some examples :
310: * <ul>
311: * <li>if the field is of type "MyClass" then the mapping will be OIDMapping (or subclass)
312: * the javaType will be OID, and the type will be MyClass.</li>
313: * <li>if the field is of type "int" then the mapping will be IntegerMapping, the javaType will
314: * be Integer, and the type will be int.</li>
315: * </ul>
316: * The "java type" is the java-type name used in the plugin.xml mapping file
317: * @return The java type
318: */
319: public abstract Class getJavaType();
320:
321: /**
322: * Accessor for the name of the java-type actually used when mapping the particular datastore
323: * field. This java-type must have an entry in the datastore mappings.
324: * The default implementation throws an UnsupportedOperationException.
325: * TODO Merge this with getJavaType().
326: *
327: * @param index requested datastore field index.
328: * @return the name of java-type for the requested datastore field.
329: */
330: public String getJavaTypeForDatastoreMapping(int index) {
331: throw new UnsupportedOperationException(
332: "Datastore type mapping is not supported by: "
333: + getClass());
334: }
335:
336: /**
337: * Accessor for the class name of the object that is being mapped here.
338: * There are mainly two situations:
339: * <ul>
340: * <li>For a JavaTypeMapping that maps a PersistentCapable class field, this will return
341: * the type of the field. For example with a field of type "MyClass" this will return "MyClass"</li>
342: * <li>For a JavaTypeMapping that maps a variable or parameter in a query, this will return
343: * the type declared in the query.</li>
344: * </ul>
345: * @return The actual type that this Mapping maps.
346: */
347: public String getType() {
348: return type;
349: }
350:
351: /**
352: * Return a sample value of the mapping type to be used for internal
353: * evaluation of type and conversion.
354: * @param clr TODO
355: * @return The sample value.
356: */
357: public abstract Object getSampleValue(ClassLoaderResolver clr);
358:
359: /**
360: * Accessor for whether this mapping is to be included in any fetch statement.
361: * @return Whether to include this mapping in a fetch statement
362: */
363: public boolean includeInFetchStatement() {
364: return true;
365: }
366:
367: /**
368: * Accessor for whether this mapping is to be included in the update statement.
369: * @return Whether to include in update statement
370: */
371: public boolean includeInUpdateStatement() {
372: return true;
373: }
374:
375: /**
376: * Accessor for whether this mapping is to be included in the insert statement.
377: * @return Whether to include in insert statement
378: */
379: public boolean includeInInsertStatement() {
380: return true;
381: }
382:
383: /**
384: * Creates a literal from an value.
385: * A string literal is enclosed in single quotes. for example: "literal".
386: * A string literal that includes a single quote is represented by two
387: * single quotes. for example: "literal''s".
388: * An exact numeric literal is a numeric value without a decimal point,
389: * such as 57, -957, +62.
390: * An approximate numeric literal is a numeric value in scientific notation,
391: * such as 7E3, -57.9E2, or a numeric value with a decimal, such as 7.,
392: * -95.7, +6.2.
393: * @param qs The Query statement
394: * @param value The object
395: * @return A Scalar Expression
396: */
397: public abstract ScalarExpression newLiteral(QueryExpression qs,
398: Object value);
399:
400: /**
401: * Creates a expression from a field name/table.
402: * e.g. tablename.fieldname; tablealias.fieldalias
403: * @param qs The Query statement
404: * @param te the alias for the table
405: * @return A Scalar Expression
406: */
407: public abstract ScalarExpression newScalarExpression(
408: QueryExpression qs, LogicSetExpression te);
409:
410: /**
411: * Utility to output any error message.
412: * @param method The method that failed.
413: * @return the localised failure message
414: **/
415: protected String failureMessage(String method) {
416: return LOCALISER.msg("041004", getClass().getName(), method);
417: }
418:
419: // ------------------- Accessors & Mutators for datastore access -----------------------
420:
421: /**
422: * Convenience setter to provide a default value for this field.
423: * If the field is nullable, a null is provided, otherwise the sample value.
424: * @param om The ObjectManager
425: * @param datastoreStatement Prepared Statement
426: * @param exprIndex The indices in the statement
427: */
428: public void setDefault(ObjectManager om, Object datastoreStatement,
429: int[] exprIndex) {
430: // TODO Dont just use the first datastore mapping and parameter number
431: getDataStoreMapping(0).setObject(
432: datastoreStatement,
433: exprIndex[0],
434: isNullable() ? null : getSampleValue(om
435: .getClassLoaderResolver()));
436: }
437:
438: /**
439: * Sets a <code>value</code> into <code>datastoreStatement</code>
440: * at position specified by <code>exprIndex</code>.
441: * @param om the ObjectManager
442: * @param datastoreStatement a datastore object that executes statements in the database
443: * @param exprIndex the position of the value in the statement
444: * @param value the value
445: */
446: public void setBoolean(ObjectManager om, Object datastoreStatement,
447: int[] exprIndex, boolean value) {
448: throw new JPOXException(failureMessage("setBoolean"))
449: .setFatal();
450: }
451:
452: /**
453: * Obtains a value from <code>datastoreResults</code>
454: * at position specified by <code>exprIndex</code>.
455: * @param om the ObjectManager
456: * @param datastoreResults an object returned from the datastore with values
457: * @param exprIndex the position of the value in the result
458: * @return the value
459: */
460: public boolean getBoolean(ObjectManager om,
461: Object datastoreResults, int[] exprIndex) {
462: throw new JPOXException(failureMessage("setBoolean"))
463: .setFatal();
464: }
465:
466: /**
467: * Sets a <code>value</code> into <code>datastoreStatement</code>
468: * at position specified by <code>exprIndex</code>.
469: * @param om the ObjectManager
470: * @param datastoreStatement a datastore object that executes statements in the database
471: * @param exprIndex the position of the value in the statement
472: * @param value the value
473: */
474: public void setChar(ObjectManager om, Object datastoreStatement,
475: int[] exprIndex, char value) {
476: throw new JPOXException(failureMessage("setChar")).setFatal();
477: }
478:
479: /**
480: * Obtains a value from <code>datastoreResults</code>
481: * at position specified by <code>exprIndex</code>.
482: * @param om the ObjectManager
483: * @param datastoreResults an object returned from the datastore with values
484: * @param exprIndex the position of the value in the result
485: * @return the value
486: */
487: public char getChar(ObjectManager om, Object datastoreResults,
488: int[] exprIndex) {
489: throw new JPOXException(failureMessage("getChar")).setFatal();
490: }
491:
492: /**
493: * Sets a <code>value</code> into <code>datastoreStatement</code>
494: * at position specified by <code>exprIndex</code>.
495: * @param om the ObjectManager
496: * @param datastoreStatement a datastore object that executes statements in the database
497: * @param exprIndex the position of the value in the statement
498: * @param value the value
499: */
500: public void setByte(ObjectManager om, Object datastoreStatement,
501: int[] exprIndex, byte value) {
502: throw new JPOXException(failureMessage("setByte")).setFatal();
503: }
504:
505: /**
506: * Obtains a value from <code>datastoreResults</code>
507: * at position specified by <code>exprIndex</code>.
508: * @param om the ObjectManager
509: * @param datastoreResults an object returned from the datastore with values
510: * @param exprIndex the position of the value in the result
511: * @return the value
512: */
513: public byte getByte(ObjectManager om, Object datastoreResults,
514: int[] exprIndex) {
515: throw new JPOXException(failureMessage("getByte")).setFatal();
516: }
517:
518: /**
519: * Sets a <code>value</code> into <code>datastoreStatement</code>
520: * at position specified by <code>exprIndex</code>.
521: * @param om the ObjectManager
522: * @param datastoreStatement a datastore object that executes statements in the database
523: * @param exprIndex the position of the value in the statement
524: * @param value the value
525: */
526: public void setShort(ObjectManager om, Object datastoreStatement,
527: int[] exprIndex, short value) {
528: throw new JPOXException(failureMessage("setShort")).setFatal();
529: }
530:
531: /**
532: * Obtains a value from <code>datastoreResults</code>
533: * at position specified by <code>exprIndex</code>.
534: * @param om the ObjectManager
535: * @param datastoreResults an object returned from the datastore with values
536: * @param exprIndex the position of the value in the result
537: * @return the value
538: */
539: public short getShort(ObjectManager om, Object datastoreResults,
540: int[] exprIndex) {
541: throw new JPOXException(failureMessage("getShort")).setFatal();
542: }
543:
544: /**
545: * Sets a <code>value</code> into <code>datastoreStatement</code>
546: * at position specified by <code>exprIndex</code>.
547: * @param om the ObjectManager
548: * @param datastoreStatement a datastore object that executes statements in the database
549: * @param exprIndex the position of the value in the statement
550: * @param value the value
551: */
552: public void setInt(ObjectManager om, Object datastoreStatement,
553: int[] exprIndex, int value) {
554: throw new JPOXException(failureMessage("setInt")).setFatal();
555: }
556:
557: /**
558: * Obtains a value from <code>datastoreResults</code>
559: * at position specified by <code>exprIndex</code>.
560: * @param om the ObjectManager
561: * @param datastoreResults an object returned from the datastore with values
562: * @param exprIndex the position of the value in the result
563: * @return the value
564: */
565: public int getInt(ObjectManager om, Object datastoreResults,
566: int[] exprIndex) {
567: throw new JPOXException(failureMessage("getInt")).setFatal();
568: }
569:
570: /**
571: * Sets a <code>value</code> into <code>datastoreStatement</code>
572: * at position specified by <code>exprIndex</code>.
573: * @param om the ObjectManager
574: * @param datastoreStatement a datastore object that executes statements in the database
575: * @param exprIndex the position of the value in the statement
576: * @param value the value
577: */
578: public void setLong(ObjectManager om, Object datastoreStatement,
579: int[] exprIndex, long value) {
580: throw new JPOXException(failureMessage("setLong")).setFatal();
581: }
582:
583: /**
584: * Obtains a value from <code>datastoreResults</code>
585: * at position specified by <code>exprIndex</code>.
586: * @param om the ObjectManager
587: * @param datastoreResults an object returned from the datastore with values
588: * @param exprIndex the position of the value in the result
589: * @return the value
590: */
591: public long getLong(ObjectManager om, Object datastoreResults,
592: int[] exprIndex) {
593: throw new JPOXException(failureMessage("getLong")).setFatal();
594: }
595:
596: /**
597: * Sets a <code>value</code> into <code>datastoreStatement</code>
598: * at position specified by <code>exprIndex</code>.
599: * @param om the ObjectManager
600: * @param datastoreStatement a datastore object that executes statements in the database
601: * @param exprIndex the position of the value in the statement
602: * @param value the value
603: */
604: public void setFloat(ObjectManager om, Object datastoreStatement,
605: int[] exprIndex, float value) {
606: throw new JPOXException(failureMessage("setFloat")).setFatal();
607: }
608:
609: /**
610: * Obtains a value from <code>datastoreResults</code>
611: * at position specified by <code>exprIndex</code>.
612: * @param om the ObjectManager
613: * @param datastoreResults an object returned from the datastore with values
614: * @param exprIndex the position of the value in the result
615: * @return the value
616: */
617: public float getFloat(ObjectManager om, Object datastoreResults,
618: int[] exprIndex) {
619: throw new JPOXException(failureMessage("getFloat")).setFatal();
620: }
621:
622: /**
623: * Sets a <code>value</code> into <code>datastoreStatement</code>
624: * at position specified by <code>exprIndex</code>.
625: * @param om the ObjectManager
626: * @param datastoreStatement a datastore object that executes statements in the database
627: * @param exprIndex the position of the value in the statement
628: * @param value the value
629: */
630: public void setDouble(ObjectManager om, Object datastoreStatement,
631: int[] exprIndex, double value) {
632: throw new JPOXException(failureMessage("setDouble")).setFatal();
633: }
634:
635: /**
636: * Obtains a value from <code>datastoreResults</code>
637: * at position specified by <code>exprIndex</code>.
638: * @param om the ObjectManager
639: * @param datastoreResults an object returned from the datastore with values
640: * @param exprIndex the position of the value in the result
641: * @return the value
642: */
643: public double getDouble(ObjectManager om, Object datastoreResults,
644: int[] exprIndex) {
645: throw new JPOXException(failureMessage("getDouble")).setFatal();
646: }
647:
648: /**
649: * Sets a <code>value</code> into <code>datastoreStatement</code>
650: * at position specified by <code>exprIndex</code>.
651: * @param om the ObjectManager
652: * @param datastoreStatement a datastore object that executes statements in the database
653: * @param exprIndex the position of the value in the statement
654: * @param value the value
655: */
656: public void setString(ObjectManager om, Object datastoreStatement,
657: int[] exprIndex, String value) {
658: throw new JPOXException(failureMessage("setString")).setFatal();
659: }
660:
661: /**
662: * Obtains a value from <code>datastoreResults</code>
663: * at position specified by <code>exprIndex</code>.
664: * @param om the ObjectManager
665: * @param datastoreResults an object returned from the datastore with values
666: * @param exprIndex the position of the value in the result
667: * @return the value
668: */
669: public String getString(ObjectManager om, Object datastoreResults,
670: int[] exprIndex) {
671: throw new JPOXException(failureMessage("getString")).setFatal();
672: }
673:
674: /**
675: * Sets a <code>value</code> into <code>datastoreStatement</code>
676: * at position specified by <code>exprIndex</code>.
677: * @param om the ObjectManager
678: * @param datastoreStatement a datastore object that executes statements in the database
679: * @param exprIndex the position of the value in the statement
680: * @param value the value
681: * @param ownerSM the owner StateManager
682: * @param ownerFieldNumber the owner absolute field number
683: */
684: public void setObject(ObjectManager om, Object datastoreStatement,
685: int[] exprIndex, Object value, StateManager ownerSM,
686: int ownerFieldNumber) {
687: throw new JPOXException(failureMessage("setObject")).setFatal();
688: }
689:
690: /**
691: * Sets a <code>value</code> into <code>datastoreStatement</code>
692: * at position specified by <code>exprIndex</code>.
693: * @param om the ObjectManager
694: * @param datastoreStatement a datastore object that executes statements in the database
695: * @param exprIndex the position of the value in the statement
696: * @param value the value
697: */
698: public void setObject(ObjectManager om, Object datastoreStatement,
699: int[] exprIndex, Object value) {
700: throw new JPOXException(failureMessage("setObject")).setFatal();
701: }
702:
703: /**
704: * Obtains a value from <code>datastoreResults</code>
705: * at position specified by <code>exprIndex</code>.
706: * @param om the ObjectManager
707: * @param datastoreResults an object returned from the datastore with values
708: * @param exprIndex the position of the value in the result
709: * @param ownerSM the owner StateManager
710: * @param ownerFieldNumber the owner absolute field number
711: * @return the value
712: */
713: public Object getObject(ObjectManager om, Object datastoreResults,
714: int[] exprIndex, StateManager ownerSM, int ownerFieldNumber) {
715: throw new JPOXException(failureMessage("getObject")).setFatal();
716: }
717:
718: /**
719: * Obtains a value from <code>datastoreResults</code>
720: * at position specified by <code>exprIndex</code>.
721: * @param om the ObjectManager
722: * @param datastoreResults an object returned from the datastore with values
723: * @param exprIndex the position of the value in the result
724: * @return the value
725: */
726: public Object getObject(ObjectManager om, Object datastoreResults,
727: int[] exprIndex) {
728: throw new JPOXException(failureMessage("getObject")).setFatal();
729: }
730: }
|