Package org.eclipse.persistence.mappings.structures

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


     * 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

        setMapping(mapping);
       
        // Process the @Column or column element if there is one.
        // A number of methods depend on this field so it must be
        // initialized before any further processing can take place.
        m_field = new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN));
               
        mapping.setField(m_field);
        mapping.setIsReadOnly(m_field.isReadOnly());
       
        mapping.setReferenceClassName(getReferenceClassName());
View Full Code Here

              DatabaseField dbfield = new DatabaseField(argumentFieldName == null ? "" : argumentFieldName);
              dbfield.type = argumentType;
              dbfield.sqlType = argumentSQLType;
              if ((argumentSqlTypeName != null) &&
                  (!argumentSqlTypeName.equals(""))) {
                  dbfield = new ObjectRelationalDatabaseField(dbfield);
                  ((ObjectRelationalDatabaseField)dbfield).setSqlTypeName(argumentSqlTypeName);
                  ((ObjectRelationalDatabaseField)dbfield).setSqlType(argumentSQLType);
                  if (nestedType != null) {
                      ((ObjectRelationalDatabaseField)dbfield).setNestedTypeField(
                          nestedType.getDatabaseField());
View Full Code Here

                 argumentFieldName = fieldName;
              }
              argumentType = dbField.type;
              argumentSQLType = dbField.sqlType;
              if (dbField.isObjectRelationalDatabaseField()) {
                  ObjectRelationalDatabaseField ordField =
                      (ObjectRelationalDatabaseField)dbField;
                  argumentSqlTypeName = ordField.getSqlTypeName();
                  argumentSQLType = ordField.getSqlType();
                  DatabaseField tempField = ordField.getNestedTypeField();
                  if (tempField != null) {
                      nestedType = new StoredProcedureArgument(tempField);
                  }
              }
          }
View Full Code Here

            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

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

                        startIdx = 1;
                        MethodArgHelper returnArg = args.get(0);
                        if (returnArg.isComplex()) {
                            String javaClassName = returnArg.typeName();
                            if (returnArg.nestedType() != null) {
                                ObjectRelationalDatabaseField nestedField =
                                    new ObjectRelationalDatabaseField("");
                                nestedField.setSqlTypeName(returnArg.nestedType());
                                nestedField.setSqlType(returnArg.nestedTypecode());
                                nestedField.setTypeName(returnArg.nestedTypeName());
                                spCall = new StoredFunctionCall(returnArg.typecode(),
                                    returnArg.sqlTypeName(), javaClassName, nestedField);
                            }
                            else {
                                spCall = new StoredFunctionCall(returnArg.typecode(),
View Full Code Here

                        arrayMapping.useCollectionClass(ArrayList.class);
                        arrayMapping.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                        DatabaseField nestedField = new DatabaseField("");
                        nestedField.setSqlType(typecode);
                        nestedField.setColumnDefinition(sqlTypeName);
                        ObjectRelationalDatabaseField field =
                            (ObjectRelationalDatabaseField)arrayMapping.getField();
                        field.setNestedTypeField(nestedField);
                        ordt.addMapping(arrayMapping);
                    }
                }
            }
            else if (listenerHelper.isArray()) {
                SqlArrayTypeHelper sqlArrayTypeHelper = (SqlArrayTypeHelper)listenerHelper;
                ObjectRelationalDataTypeDescriptor ordt =
                    descriptorMap.get(sqlArrayTypeHelper.arrayTypename());
                DatabaseMapping dm = ordt.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
                if (dm == null) {
                    ArrayMapping arrayMapping = new ArrayMapping();
                    arrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
                    arrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
                    arrayMapping.useCollectionClass(ArrayList.class);
                    arrayMapping.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                    DatabaseField nestedField = new DatabaseField("");
                    nestedField.setSqlType(typecode);
                    nestedField.setColumnDefinition(sqlTypeName);
                    ObjectRelationalDatabaseField field =
                        (ObjectRelationalDatabaseField)arrayMapping.getField();
                    field.setNestedTypeField(nestedField);
                    ordt.addMapping(arrayMapping);
                }
                ListenerHelper listenerHelper3 = stac.peek();
                ListenerHelper listenerHelper4 = null;
                if (listenerHelper3.isArray()) {
                    /*
                     * table of table scenario:
                    CREATE TYPE SOMEPACKAGE_TBL2 AS TABLE OF NUMBER;
                    CREATE TYPE SOMEPACKAGE_TBL4 AS TABLE OF SOMEPACKAGE_TBL2;
                     */
                    SqlArrayTypeHelper sqlArrayTypeHelper2 = (SqlArrayTypeHelper)listenerHelper3;
                    stac.pop();
                    ObjectRelationalDataTypeDescriptor ordt3 =
                        descriptorMap.get(sqlArrayTypeHelper2.arrayTypename());
                    DatabaseMapping dm3 = ordt3.getMappingForAttributeName(ITEMS_ATTRIBUTE_NAME);
                    if (dm3 == null) {
                        ObjectArrayMapping objArrayMapping = new ObjectArrayMapping();
                        objArrayMapping.setAttributeName(ITEMS_ATTRIBUTE_NAME);
                        objArrayMapping.setFieldName(ITEMS_ATTRIBUTE_NAME);
                        objArrayMapping.setStructureName(sqlArrayTypeHelper2.arrayTypename().toUpperCase());
                        objArrayMapping.setReferenceClassName(ordt.getJavaClassName());
                        objArrayMapping.useCollectionClass(ArrayList.class);
                        ordt3.addMapping(objArrayMapping);
                    }
                    // more stack peeking
                    if (stac.peek().isAttribute()) {
                        listenerHelper4 = stac.peek();
                    }
                }
                else {
                    listenerHelper4 = listenerHelper3;
                }
                if (listenerHelper4.isAttribute()) {
                    // type built above used in field definition of object further up stack
                    AttributeFieldHelper fieldHelper = (AttributeFieldHelper)listenerHelper4;
                    stac.pop();
                    ListenerHelper listenerHelper5 = stac.peek();
                    if (listenerHelper5.isObject()) {
                        ObjectTypeHelper objectTypeHelper = (ObjectTypeHelper)listenerHelper5;
                        ObjectRelationalDataTypeDescriptor ordt2 =
                            descriptorMap.get(objectTypeHelper.objectTypename());
                        String fieldName = fieldHelper.attributeFieldName();
                        DatabaseMapping dm2 =
                            ordt2.getMappingForAttributeName(fieldName.toLowerCase());
                        if (dm2 == null) {
                            ordt2.addFieldOrdering(fieldName);
                            // simple or complex array?
                            if (listenerHelper4 == listenerHelper3) {
                                ArrayMapping arrayMapping2 = new ArrayMapping();
                                arrayMapping2.setAttributeName(fieldName.toLowerCase());
                                arrayMapping2.setFieldName(fieldName);
                                arrayMapping2.setStructureName(sqlArrayTypeHelper.arrayTypename().toUpperCase());
                                arrayMapping2.useCollectionClass(ArrayList.class);
                                DatabaseField nestedField = new DatabaseField("");
                                nestedField.setSqlType(typecode);
                                nestedField.setColumnDefinition(sqlTypeName);
                                ObjectRelationalDatabaseField field =
                                    (ObjectRelationalDatabaseField)arrayMapping2.getField();
                                field.setNestedTypeField(nestedField);
                                ordt2.addMapping(arrayMapping2);
                            }
                            else {
                                ObjectArrayMapping objArrayMapping2 = new ObjectArrayMapping();
                                objArrayMapping2.setAttributeName(fieldName.toLowerCase());
View Full Code Here

        setMapping(mapping);
       
        // Process the @Column or column element if there is one.
        // A number of methods depend on this field so it must be
        // initialized before any further processing can take place.
        m_field = new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN));
               
        mapping.setField(m_field);
        mapping.setIsReadOnly(m_field.isReadOnly());
       
        mapping.setReferenceClassName(getReferenceClassName());
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField

Copyright © 2018 www.massapicom. 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.