Examples of ObjectRelationalDatabaseField


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 = getJDBCTypeForSetNull(databaseField);
            statement.setNull(index, jdbcType);
        }
    }
View Full Code Here

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

        }
        if (dbField == null || (!dbField.isObjectRelationalDatabaseField())){
            return parameter;
        }
        //handle STRUCT conversions
        ObjectRelationalDatabaseField ordField = ((ObjectRelationalDatabaseField)dbField);
        if (dbField.getSqlType()==Types.STRUCT){
            if (!(parameter instanceof Struct)){
                ClassDescriptor descriptor=session.getDescriptor(parameter);
                if ((descriptor!=null) && (descriptor.isObjectRelationalDataTypeDescriptor())){
                    //this is used to convert non-null objects passed through stored procedures and custom SQL to structs
                    ObjectRelationalDataTypeDescriptor ord=(ObjectRelationalDataTypeDescriptor)descriptor;
                    AbstractRecord nestedRow = ord.getObjectBuilder().buildRow(parameter, session, WriteType.UNDEFINED);
                    return ord.buildStructureFromRow(nestedRow, session, connection);
                }
            }
            return parameter;
        }
        // Handle java.sql.Array conversions from Collection or Java Arrays.
        if (parameter instanceof Object[]) {
          parameter = Arrays.asList((Object[])parameter);
        }
        if ((dbField.getSqlType()!=Types.ARRAY)||(parameter instanceof Array) || !(parameter instanceof Collection) ){
            return parameter;
        }
       
        Collection container = (Collection)parameter;
       
        DatabaseField nestedType = ordField.getNestedTypeField();

        Object[] fields = new Object[container.size()];
        int i = 0;
        for (Iterator iter = container.iterator(); iter.hasNext();) {
            Object element = iter.next();
View Full Code Here

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

        }
        if (dbField == null || (!dbField.isObjectRelationalDatabaseField())){
            return parameter;
        }
        //handle STRUCT conversions
        ObjectRelationalDatabaseField ordField = ((ObjectRelationalDatabaseField)dbField);
        if (dbField.getSqlType()==Types.STRUCT){
            if (!(parameter instanceof Struct)){
                ClassDescriptor descriptor=session.getDescriptor(parameter);
                if ((descriptor!=null) && (descriptor.isObjectRelationalDataTypeDescriptor())){
                    //this is used to convert non-null objects passed through stored procedures and custom SQL to structs
                    ObjectRelationalDataTypeDescriptor ord=(ObjectRelationalDataTypeDescriptor)descriptor;
                    AbstractRecord nestedRow = ord.getObjectBuilder().buildRow(parameter, session);
                    return ord.buildStructureFromRow(nestedRow, session, connection);
                }
            }
            return parameter;
        }
        // Handle java.sql.Array conversions from Collection or Java Arrays.
        if (parameter instanceof Object[]) {
          parameter = Arrays.asList((Object[])parameter);
        }
        if ((dbField.getSqlType()!=Types.ARRAY)||(parameter instanceof Array) || !(parameter instanceof Collection) ){
            return parameter;
        }
       
        Collection container = (Collection)parameter;
       
        DatabaseField nestedType = ordField.getNestedTypeField();

        Object[] fields = new Object[container.size()];
        int i = 0;
        for (Iterator iter = container.iterator(); iter.hasNext();) {
            Object element = iter.next();
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

     * TThe argumentFieldName is the field or argument name used in the SQL.
     * The type is the JDBC type code for the parameter.
     * The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types.
     */
    public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName) {
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        getParameters().add(field);
        getParameterTypes().add(null);
    }
View Full Code Here

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

     * The type is the JDBC type code for the parameter.
     * 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.
     */
    public void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class javaType) {
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        field.setType(javaType);
        getParameters().add(field);
        getParameterTypes().add(null);
    }
View Full Code Here

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

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

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

     * The type is the JDBC type code, this is dependent on the type required by the procedure.
     * The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types.
     */
    public void addNamedArgument(String procedureParameterName, String argumentFieldName, int type, String typeName) {
        getProcedureArgumentNames().add(procedureParameterName);
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        appendIn(field);
    }
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.