Examples of ObjectRelationalDatabaseField


Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

     * The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types.
     * The javaType is the java class to return instead of the ARRAY and STRUCT types if a conversion is possible.
     * The nestedType is a DatabaseField with type information set to match the VARRAYs object types
     */
    public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class javaType, DatabaseField nestedType) {
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        field.setType(javaType);
        field.setNestedTypeField(nestedType);
        getParameters().add(field);
        getParameterTypes().add(null);
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

                ComplexDatabaseType complexType = (ComplexDatabaseType) type;
                if (inArg.inIndex != MIN_VALUE) {
                    if (type instanceof PLSQLCollection) {
                        DatabaseType nestedType = ((PLSQLCollection) type).getNestedType();
                        if (nestedType != null) {
                            ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(inArg.name);
                            field.setSqlType(nestedType.getConversionCode());
                            if (nestedType.isComplexDatabaseType()) {
                                field.setSqlTypeName(((ComplexDatabaseType) nestedType).getCompatibleType());
                            }
                            super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType(), field);
                        } else {
                            super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
                        }
                    } else {
                        super.addNamedArgument(inArg.name, inArg.name, type.getConversionCode(), complexType.getCompatibleType());
                    }
                }
            }
        }
        List<PLSQLargument> outArguments = getArguments(arguments, OUT);
        outArguments.addAll(inOutArguments);
        for (ListIterator<PLSQLargument> outArgsIter = outArguments.listIterator(); outArgsIter.hasNext();) {
            PLSQLargument outArg = outArgsIter.next();
            newIndex = outArg.databaseType.computeOutIndex(outArg, newIndex, outArgsIter);
        }
        for (PLSQLargument outArg : outArguments) {
            DatabaseType type = outArg.databaseType;
            if (!type.isComplexDatabaseType()) {
                super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode());
            } else {
                ComplexDatabaseType complexType = (ComplexDatabaseType) type;
                if (outArg.outIndex != MIN_VALUE) {
                    if (complexType instanceof PLSQLCollection) {
                        DatabaseType nestedType = ((PLSQLCollection) complexType).getNestedType();
                        if (nestedType != null) {
                            ObjectRelationalDatabaseField nestedField = new ObjectRelationalDatabaseField(outArg.name);
                            nestedField.setSqlType(nestedType.getConversionCode());
                            if (nestedType.isComplexDatabaseType()) {
                                ComplexDatabaseType complexNestedType = (ComplexDatabaseType) nestedType;
                                nestedField.setType(complexNestedType.getJavaType());
                                nestedField.setSqlTypeName(complexNestedType.getCompatibleType());
                            }
                            super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType(), complexType.getJavaType(), nestedField);
                        } else {
                            super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType());
                        }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

            StructConverter converter = typeConverters.get(field.getType());
           
            if (converter != null) {
                Object bindValue = value;
                if (bindValue == null) {
                    bindValue = new ObjectRelationalDatabaseField(field);
                    ((ObjectRelationalDatabaseField)bindValue).setSqlType(java.sql.Types.STRUCT);
                    ((ObjectRelationalDatabaseField)bindValue).setSqlTypeName(converter.getStructName());
                }
                return new BindCallCustomParameter(bindValue);
            }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

        // Substituted null value for the corresponding DatabaseField.
        // Cannot bind null through set object, so we must compute the type, this is not good.
        // Fix for bug 2730536: for ARRAY/REF/STRUCT types must pass in the
        // user defined type to setNull as well.
        if (databaseField instanceof ObjectRelationalDatabaseField) {
            ObjectRelationalDatabaseField field = (ObjectRelationalDatabaseField)databaseField;
            statement.setNull(index, field.getSqlType(), field.getSqlTypeName());
        } else {
            int jdbcType = getJDBCType(databaseField);
            statement.setNull(index, jdbcType);
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

        addUnamedOutputArgument("", sqlType, sqlTypeName, javaType, nestedType);
    }
   
    public StoredFunctionCall(int sqlType, String sqlTypeName, String javaTypeClassName) {
        this(sqlType, sqlTypeName, (Class)null);
        ObjectRelationalDatabaseField ordf = (ObjectRelationalDatabaseField)parameters.get(0);
        ordf.setTypeName(javaTypeClassName);
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

        ordf.setTypeName(javaTypeClassName);
    }

    public StoredFunctionCall(int sqlType, String sqlTypeName, String javaTypeClassName, DatabaseField nestedType) {
        this(sqlType, sqlTypeName, javaTypeClassName);
        ObjectRelationalDatabaseField ordf = (ObjectRelationalDatabaseField)parameters.get(0);
        ordf.setNestedTypeField(nestedType);
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

     * PUBLIC:
     * Define the field name to be substitute for the function return.
     * The type is the type of Java class desired back from the function, this is dependent on the type returned from the function.
     */
    public void setResult(String name, int type, String typeName) {
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(name);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        getParameters().set(0, field);
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

            StructConverter converter = typeConverters.get(field.getType());
           
            if (converter != null) {
                Object bindValue = value;
                if (bindValue == null) {
                    bindValue = new ObjectRelationalDatabaseField(field);
                    ((ObjectRelationalDatabaseField)bindValue).setSqlType(java.sql.Types.STRUCT);
                    ((ObjectRelationalDatabaseField)bindValue).setSqlTypeName(converter.getStructName());
                }
                return new BindCallCustomParameter(bindValue);
            }
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

            // Substituted null value for the corresponding DatabaseField.
            // Cannot bind null through set object, so we must compute the type, this is not good.
            // Fix for bug 2730536: for ARRAY/REF/STRUCT types must pass in the
            // user defined type to setNull as well.
            if (parameter instanceof ObjectRelationalDatabaseField) {
                ObjectRelationalDatabaseField field = (ObjectRelationalDatabaseField)parameter;
                statement.setNull(index, field.getSqlType(), field.getSqlTypeName());
            } else {
                int jdbcType = getJDBCType((DatabaseField)parameter);
                statement.setNull(index, jdbcType);
            }
        } else if (parameter instanceof byte[]) {
View Full Code Here

Examples of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

                (spCall.isStoredFunctionCall() && !isCursorType(xrService, resultType))) {
                setSingleResult(xrService, spCall, resultType);
               
                // if the JDBC Type code is set on the result, use it
                if (queryOperation.getResult().isJdbcTypeSet()) {
                    ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(EMPTY_STRING);
                    field.setSqlType(queryOperation.getResult().getJdbcType());
                    field.setSqlTypeName(getTypeNameForJDBCType(queryOperation.getResult().getJdbcType()));
                    // replace the original field with the new one
                    ((StoredFunctionCall)spCall).getParameters().remove(0);
                    ((StoredFunctionCall)spCall).getParameters().add(0, field);
                }
                // support stored function with out args
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.