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 (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

        }
        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

     * 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

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

     * The typeName is the JDBC type name, as required for STRUCT and ARRAY types.
     * The nestedType is a DatabaseField with type information set to match the VARRAYs object types
     */
    public void addNamedArgument(String procedureParameterName, String argumentFieldName, int type, String typeName, DatabaseField nestedType) {
        getProcedureArgumentNames().add(procedureParameterName);
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        field.setNestedTypeField(nestedType);
        appendIn(field);
    }
View Full Code Here

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

     * 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 addNamedInOutputArgument(String procedureParameterName, String inArgumentFieldName, String outArgumentFieldName, int type, String typeName, Class javaType, DatabaseField nestedType) {
        getProcedureArgumentNames().add(procedureParameterName);
        ObjectRelationalDatabaseField inField = new ObjectRelationalDatabaseField(inArgumentFieldName);
        inField.setSqlType(type);
        inField.setSqlTypeName(typeName);
        inField.setType(javaType);//needed for out, less neccessary for in.  maybe use containerPolicy instead?
        inField.setNestedTypeField(nestedType);
        if (inArgumentFieldName.equals(outArgumentFieldName)) {
            appendInOut(inField);
        } else {
            ObjectRelationalDatabaseField outField = new ObjectRelationalDatabaseField(outArgumentFieldName);
            outField.setSqlType(type);
            outField.setSqlTypeName(typeName);
            outField.setType(javaType);//needed for out, less neccessary for in.  maybe use containerPolicy instead?
            outField.setNestedTypeField(nestedType);
            appendInOut(inField, outField);
        }
    }
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 returned from the procedure.
     * The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types.
     */
    public void addNamedOutputArgument(String procedureParameterName, String argumentFieldName, int type, String typeName) {
        getProcedureArgumentNames().add(procedureParameterName);
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(type);
        field.setSqlTypeName(typeName);
        appendOut(field);
    }
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 and STRUCT types.
     * The javaType is the java class to return instead of the ARRAY and STRUCT types if a conversion is possible.
     */
    public void addNamedOutputArgument(String procedureParameterName, String argumentFieldName, int jdbcType, String typeName, Class javaType) {
      getProcedureArgumentNames().add(procedureParameterName);
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(jdbcType);
        field.setSqlTypeName(typeName);
        field.setType(javaType);
        appendOut(field);
    }
View Full Code Here

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

     * 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 addNamedOutputArgument(String procedureParameterName, String argumentFieldName, int jdbcType, String typeName, Class javaType, DatabaseField nestedType) {
        getProcedureArgumentNames().add(procedureParameterName);
        ObjectRelationalDatabaseField field = new ObjectRelationalDatabaseField(argumentFieldName);
        field.setSqlType(jdbcType);
        field.setSqlTypeName(typeName);
        field.setType(javaType);
        field.setNestedTypeField(nestedType);
        appendOut(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.