/** * ADVANCED: * Return the class type of the field value. * This can be used if field value differs from the object value, * has specific typing requirements such as usage of java.sql.Blob or NChar. */ public Class getFieldClassification() { if (getField() == null) { return null; } return getField().getType(); }
public InOutputParameterForCallableStatement(Object inParameter, DatabaseField outField, DatabasePlatform platform) { if ((outField.getType() == null) && (inParameter != null)) { DatabaseField typeField = (DatabaseField)outField.clone(); if (inParameter instanceof DatabaseField) { typeField.setType(((DatabaseField)inParameter).getType()); } else { typeField.setType(inParameter.getClass()); } outField = typeField; } obj = outField; prepare(platform); if (inParameter == null) { this.inParameter = getOutputField(); } else { this.inParameter = inParameter; } }
/** * INTERNAL: * It is responsible for initializing the policy properties; */ public void initializeProperties() { DatabaseField dbField = getWriteLockField(); descriptor.buildField(dbField); if (dbField.getType() == null) { //set the default type dbField.setType(getDefaultLockingFieldType()); } Enumeration enumtr = this.getUnmappedFields().elements(); while (enumtr.hasMoreElements()) { DatabaseField lockField; lockField = (DatabaseField)enumtr.nextElement(); descriptor.getFields().addElement(lockField); } }
/** * INTERNAL: * Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods. */ protected void afterTranslateCustomQueryUpdateParameter(DatabaseField field, int index, Integer parameterType, Vector updatedParameters, Vector updatedParameterTypes) { for (int j = 0; j < updatedParameters.size(); j++) { DatabaseField updateField = (DatabaseField)updatedParameters.elementAt(j); if (field.equals(updateField)) { Integer updateParameterType = (Integer)updatedParameterTypes.elementAt(j); if (updateParameterType == null) { field.setType(updateField.getType()); } else if (updateParameterType == OUT_CURSOR) { if (parameterType == OUT) { getParameterTypes().setElementAt(OUT_CURSOR, index); } else { throw ValidationException.cannotSetCursorForParameterTypeOtherThanOut(field.getName(), toString()); } } break; } } }
/** * Build the row from the primary key values. */ public AbstractRecord buildRowFromPrimaryKeyValues(Vector key, AbstractSession session) { AbstractRecord databaseRow = createRecord(key.size()); int keySize = key.size(); for (int index = 0; index < keySize; index++) { DatabaseField field = (DatabaseField)getDescriptor().getPrimaryKeyFields().get(index); Object value = key.elementAt(index); value = session.getPlatform(getDescriptor().getJavaClass()).getConversionManager().convertObject(value, field.getType()); databaseRow.put(field, value); } return databaseRow; }
/** * Return the JDBC type for the given database field. */ public int getJDBCType(DatabaseField field) { if (field != null) { // If the field has a specified JDBC type, use it, // otherwise compute the type from the Java class type. if (field.getSqlType() != -1) { return field.getSqlType(); } else { return getJDBCType(ConversionManager.getObjectClass(field.getType())); } } else { return getJDBCType((Class)null); } }
if (field.getType() != null) { value = field; } else if (modifyRow != null) { DatabaseField modifyField = modifyRow.getField(field); if ((modifyField != null) && (modifyField.getType() != null)) { value = modifyField; throw QueryException.namedArgumentNotFoundInQueryParameters(field.getName()); if (translationField.getType() != null) { value = translationField;
if ((field.getType() == null) || session.getPlatform().shouldUseCustomModifyForCall(field)) { getParameterTypes().setElementAt(CUSTOM_MODIFY, i); setIsCallableStatementRequired(true); DatabaseField outField = (DatabaseField)((Object[])parameter)[1]; if (outField.getType() == null) { DatabaseField typeOutField = getFieldWithTypeFromDescriptor(outField); if (typeOutField != null) { if (outField.getType() != null) { if (outField.getType() == null) { DatabaseField typeOutField = getFieldWithTypeFromDescriptor(outField); if (typeOutField != null) {
/** * INTERNAL: * searches first descriptor than its ReturningPolicy for an equal field */ public DatabaseField getTypedField(DatabaseField field) { boolean mayBeMoreThanOne = hasMultipleTables() && !field.hasTableName(); DatabaseField foundField = null; for (int j = 0; j < getFields().size(); j++) { DatabaseField descField = (DatabaseField)getFields().elementAt(j); if (field.equals(descField)) { if (descField.getType() != null) { foundField = descField; if (!mayBeMoreThanOne || descField.getTable().equals(getDefaultTable())) { break; } } } } if (foundField != null) { foundField = (DatabaseField)foundField.clone(); if (!field.hasTableName()) { foundField.setTableName(""); } } return foundField; }
if (field.getType() == null) { DatabaseMapping mapping = getObjectBuilder().getMappingForField(field); if (mapping != null) {
fieldDef = new FieldDefinition(field.getName(), ConversionManager.getObjectClass(field.getType())); }else{ fieldDef = new FieldDefinition(field.getName(), field.getColumnDefinition());
Class fieldType = dbField.getType();
Object classFieldValue = session.getDatasourcePlatform().getConversionManager().convertObject(rowFromDatabase.get(getClassIndicatorField()), getClassIndicatorField().getType());
resolvedDatabaseField.setType(resolvedParentField.getType()); resolvedDatabaseField.setScale(resolvedParentField.getScale()); resolvedDatabaseField.setLength(resolvedParentField.getLength());