Search in sources :

Example 6 with ArgumentType

use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.

the class OracleHelper method buildQueryForProcedureType.

/**
 * Build a Query for the given ProcedureType instance and add
 * it to the given OR project's list of queries.
 */
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void buildQueryForProcedureType(ProcedureType procType, Project orProject, Project oxProject, ProcedureOperationModel opModel, boolean hasPLSQLArgs) {
    // if there are one or more PL/SQL args, then we need a PLSQLStoredProcedureCall
    StoredProcedureCall call;
    ArgumentType returnArg = procType.isFunctionType() ? ((FunctionType) procType).getReturnArgument() : null;
    // check for PL/SQL cursor arg
    boolean hasCursor = hasPLSQLCursorArg(getArgumentListForProcedureType(procType));
    hasPLSQLArgs = hasPLSQLArgs || hasCursor || opModel.isPLSQLProcedureOperation();
    if (hasPLSQLArgs) {
        if (procType.isFunctionType()) {
            org.eclipse.persistence.internal.helper.DatabaseType dType = buildDatabaseTypeFromMetadataType(returnArg, procType.getCatalogName());
            if (hasCursor) {
                call = new PLSQLStoredFunctionCall();
                // constructor by default adds a RETURN argument, so remove it
                ((PLSQLStoredFunctionCall) call).getArguments().remove(0);
                ((PLSQLStoredFunctionCall) call).useNamedCursorOutputAsResultSet(CURSOR_STR, dType);
            } else {
                Class wrapperClass = getWrapperClass(dType);
                if (wrapperClass != null) {
                    ((ComplexDatabaseType) dType).setJavaType(wrapperClass);
                }
                call = new PLSQLStoredFunctionCall(dType);
                // check for non-associative collection
                if (returnArg.getEnclosedType().isPLSQLCollectionType() && !((PLSQLCollectionType) returnArg.getEnclosedType()).isIndexed()) {
                    PLSQLargument plsqlArg = ((PLSQLStoredFunctionCall) call).getArguments().get(0);
                    ((PLSQLCollection) plsqlArg.databaseType).setIsNestedTable(true);
                }
            }
        } else {
            call = new PLSQLStoredProcedureCall();
        }
    } else {
        if (procType.isFunctionType()) {
            String javaTypeName = returnArg.getTypeName();
            ClassDescriptor desc = oxProject.getDescriptorForAlias(getGeneratedAlias(javaTypeName));
            if (desc != null) {
                javaTypeName = desc.getJavaClassName();
            }
            if (returnArg.isComposite()) {
                DatabaseType dataType = returnArg.getEnclosedType();
                if (dataType.isVArrayType() || dataType.isObjectTableType()) {
                    call = new StoredFunctionCall(Types.ARRAY, returnArg.getTypeName(), javaTypeName, buildFieldForNestedType(dataType));
                } else {
                    // assumes ObjectType
                    call = new StoredFunctionCall(Types.STRUCT, returnArg.getTypeName(), javaTypeName);
                }
            } else {
                // scalar
                call = new StoredFunctionCall();
                if (returnArg.getEnclosedType().isBlobType()) {
                    // handle BLOBs
                    ((StoredFunctionCall) call).setResult(null, ClassConstants.BLOB);
                } else {
                    int resultType = Util.getJDBCTypeFromTypeName(javaTypeName);
                    // need special handling for Date types
                    if (resultType == Types.DATE || resultType == Types.TIME || resultType == Types.TIMESTAMP) {
                        ((StoredFunctionCall) call).setResult(null, ClassConstants.TIMESTAMP);
                    } else if (returnArg.getEnclosedType() == ScalarDatabaseTypeEnum.XMLTYPE_TYPE) {
                        // special handling for XMLType types
                        ((StoredFunctionCall) call).setResult(getJDBCTypeForTypeName(XMLTYPE_STR), XMLTYPE_STR, ClassConstants.OBJECT);
                    } else if (resultType == Types.OTHER || resultType == Types.CLOB) {
                        // default to OBJECT for OTHER, CLOB and LONG types
                        ((StoredFunctionCall) call).setResult(null, ClassConstants.OBJECT);
                    } else {
                        ((StoredFunctionCall) call).setResult(null, resultType);
                    }
                }
            }
        } else {
            call = new StoredProcedureCall();
        }
    }
    String cat = procType.getCatalogName();
    String catalogPrefix = (cat == null || cat.length() == 0) ? EMPTY_STRING : cat + DOT;
    call.setProcedureName(catalogPrefix + procType.getProcedureName());
    String returnType = opModel.getReturnType();
    boolean hasResponse = returnType != null;
    DatabaseQuery dq = null;
    if (hasCursor || (hasResponse && opModel.isCollection())) {
        dq = new DataReadQuery();
    } else {
        dq = new ValueReadQuery();
    }
    dq.bindAllParameters();
    dq.setName(getNameForQueryOperation(opModel, procType));
    dq.setCall(call);
    for (ArgumentType arg : procType.getArguments()) {
        // handle optional arg
        if (arg.optional()) {
            call.addOptionalArgument(arg.getArgumentName());
        }
        DatabaseType argType = arg.getEnclosedType();
        ArgumentTypeDirection direction = arg.getDirection();
        // for PL/SQL
        org.eclipse.persistence.internal.helper.DatabaseType databaseType = null;
        // for Advanced JDBC
        String javaTypeName = null;
        if (hasPLSQLArgs) {
            databaseType = buildDatabaseTypeFromMetadataType(argType, cat);
        } else {
            javaTypeName = argType.getTypeName();
            ClassDescriptor desc = oxProject.getDescriptorForAlias(getGeneratedAlias(javaTypeName));
            if (desc != null) {
                // anything there's a descriptor for will include "packagename." in the class name
                javaTypeName = desc.getJavaClassName();
            }
        }
        if (direction == IN) {
            if (hasPLSQLArgs) {
                Class wrapperClass = getWrapperClass(databaseType);
                if (wrapperClass != null) {
                    ((ComplexDatabaseType) databaseType).setJavaType(wrapperClass);
                }
                ((PLSQLStoredProcedureCall) call).addNamedArgument(arg.getArgumentName(), databaseType);
                // check for non-associative collection
                if (argType.isPLSQLCollectionType() && !((PLSQLCollectionType) argType).isIndexed()) {
                    PLSQLargument plsqlArg = ((PLSQLStoredProcedureCall) call).getArguments().get(((PLSQLStoredProcedureCall) call).getArguments().size() - 1);
                    ((PLSQLCollection) plsqlArg.databaseType).setIsNestedTable(true);
                }
            } else {
                if (argType.isVArrayType()) {
                    dq.addArgument(arg.getArgumentName());
                    call.addNamedArgument(arg.getArgumentName(), arg.getArgumentName(), Types.ARRAY, argType.getTypeName(), javaTypeName);
                } else if (argType.isObjectType()) {
                    dq.addArgument(arg.getArgumentName());
                    call.addNamedArgument(arg.getArgumentName(), arg.getArgumentName(), Types.STRUCT, argType.getTypeName(), javaTypeName);
                } else if (argType.isObjectTableType()) {
                    dq.addArgument(arg.getArgumentName(), java.sql.Array.class);
                    call.addNamedArgument(arg.getArgumentName(), arg.getArgumentName(), Types.ARRAY, argType.getTypeName(), getWrapperClass(javaTypeName), buildFieldForNestedType(argType));
                } else {
                    dq.addArgument(arg.getArgumentName());
                    call.addNamedArgument(arg.getArgumentName(), arg.getArgumentName(), Util.getJDBCTypeFromTypeName(argType.getTypeName()));
                }
            }
        } else if (direction == OUT) {
            if (hasPLSQLArgs) {
                if (arg.isPLSQLCursorType()) {
                    ((PLSQLStoredProcedureCall) call).useNamedCursorOutputAsResultSet(arg.getArgumentName(), databaseType);
                } else {
                    Class wrapperClass = getWrapperClass(databaseType);
                    if (wrapperClass != null) {
                        ((ComplexDatabaseType) databaseType).setJavaType(wrapperClass);
                    }
                    ((PLSQLStoredProcedureCall) call).addNamedOutputArgument(arg.getArgumentName(), databaseType);
                }
            } else {
                if (argType.isComposite()) {
                    Class wrapperClass = getWrapperClass(javaTypeName);
                    if (argType.isVArrayType() || argType.isObjectTableType()) {
                        call.addNamedOutputArgument(arg.getArgumentName(), arg.getArgumentName(), Types.ARRAY, argType.getTypeName(), wrapperClass, buildFieldForNestedType(argType));
                    } else {
                        // assumes ObjectType
                        call.addNamedOutputArgument(arg.getArgumentName(), arg.getArgumentName(), Types.STRUCT, argType.getTypeName(), wrapperClass);
                    }
                } else {
                    // need special handling for XMLType - we want the type code to be 'OPAQUE' (2007)
                    if (argType == ScalarDatabaseTypeEnum.XMLTYPE_TYPE) {
                        call.addNamedOutputArgument(arg.getArgumentName(), arg.getArgumentName(), getJDBCTypeForTypeName(XMLTYPE_STR), XMLTYPE_STR);
                    } else if (argType == ScalarDatabaseTypeEnum.SYS_REFCURSOR_TYPE) {
                        call.addNamedCursorOutputArgument(arg.getArgumentName());
                    } else {
                        call.addNamedOutputArgument(arg.getArgumentName(), arg.getArgumentName(), Util.getJDBCTypeFromTypeName(argType.getTypeName()));
                    }
                }
            }
        } else {
            // INOUT
            if (hasPLSQLArgs) {
                Class wrapperClass = getWrapperClass(databaseType);
                if (wrapperClass != null) {
                    ((ComplexDatabaseType) databaseType).setJavaType(wrapperClass);
                }
                ((PLSQLStoredProcedureCall) call).addNamedInOutputArgument(arg.getArgumentName(), databaseType);
                // check for non-associative collection
                if (argType.isPLSQLCollectionType() && !((PLSQLCollectionType) argType).isIndexed()) {
                    PLSQLargument plsqlArg = ((PLSQLStoredProcedureCall) call).getArguments().get(((PLSQLStoredProcedureCall) call).getArguments().size() - 1);
                    ((PLSQLCollection) plsqlArg.databaseType).setIsNestedTable(true);
                }
            } else {
                dq.addArgument(arg.getArgumentName());
                if (argType.isComposite()) {
                    Class wrapperClass = getWrapperClass(javaTypeName);
                    if (argType.isVArrayType() || argType.isObjectTableType()) {
                        call.addNamedInOutputArgument(arg.getArgumentName(), arg.getArgumentName(), arg.getArgumentName(), Types.ARRAY, argType.getTypeName(), wrapperClass, buildFieldForNestedType(argType));
                    } else {
                        // assumes ObjectType
                        call.addNamedInOutputArgument(arg.getArgumentName(), arg.getArgumentName(), arg.getArgumentName(), Types.STRUCT, argType.getTypeName());
                    }
                } else {
                    // for some reason setting "java.lang.String" as the java type causes problems at runtime
                    Class javaType = getClassFromJDBCType(argType.getTypeName(), dbwsBuilder.getDatabasePlatform());
                    if (shouldSetJavaType(javaType.getName())) {
                        call.addNamedInOutputArgument(arg.getArgumentName(), arg.getArgumentName(), arg.getArgumentName(), Util.getJDBCTypeFromTypeName(argType.getTypeName()), argType.getTypeName(), javaType);
                    } else {
                        call.addNamedInOutputArgument(arg.getArgumentName());
                    }
                }
            }
        }
        if (hasPLSQLArgs && (direction == IN || direction == INOUT)) {
            ClassDescriptor xdesc = null;
            if (hasResponse) {
                int idx = returnType.indexOf(COLON);
                if (idx == -1) {
                    idx = returnType.indexOf(CLOSE_PAREN);
                }
                if (idx > 0) {
                    String typ = returnType.substring(idx + 1);
                    for (XMLDescriptor xd : (List<XMLDescriptor>) (List) oxProject.getOrderedDescriptors()) {
                        if (xd.getSchemaReference() != null) {
                            String context = xd.getSchemaReference().getSchemaContext();
                            if (context.substring(1).equals(typ)) {
                                xdesc = xd;
                                break;
                            }
                        }
                    }
                }
            }
            if (xdesc != null) {
                dq.addArgumentByTypeName(arg.getArgumentName(), xdesc.getJavaClassName());
            } else {
                if (databaseType instanceof PLSQLCollection || databaseType instanceof VArrayType) {
                    dq.addArgument(arg.getArgumentName(), Array.class);
                } else if (databaseType instanceof PLSQLrecord || databaseType instanceof OracleObjectType) {
                    dq.addArgument(arg.getArgumentName(), Struct.class);
                } else {
                    dq.addArgument(arg.getArgumentName(), JDBCTypes.getClassForCode(databaseType.getConversionCode()));
                }
            }
        }
    }
    orProject.getQueries().add(dq);
}
Also used : PLSQLStoredFunctionCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredFunctionCall) ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) CompositeDatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType) ComplexDatabaseType(org.eclipse.persistence.internal.helper.ComplexDatabaseType) DatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType) Util.getAttributeClassForDatabaseType(org.eclipse.persistence.tools.dbws.Util.getAttributeClassForDatabaseType) DataReadQuery(org.eclipse.persistence.queries.DataReadQuery) Util.qNameFromString(org.eclipse.persistence.tools.dbws.Util.qNameFromString) ArgumentType(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType) PLSQLargument(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLargument) Struct(java.sql.Struct) XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) VArrayType(org.eclipse.persistence.tools.oracleddl.metadata.VArrayType) OracleObjectType(org.eclipse.persistence.platform.database.oracle.jdbc.OracleObjectType) PLSQLrecord(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLrecord) ArrayList(java.util.ArrayList) List(java.util.List) ArgumentTypeDirection(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentTypeDirection) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) StoredProcedureCall(org.eclipse.persistence.queries.StoredProcedureCall) DatabaseQuery(org.eclipse.persistence.queries.DatabaseQuery) ValueReadQuery(org.eclipse.persistence.queries.ValueReadQuery) StoredFunctionCall(org.eclipse.persistence.queries.StoredFunctionCall) PLSQLStoredFunctionCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredFunctionCall) ComplexDatabaseType(org.eclipse.persistence.internal.helper.ComplexDatabaseType) PLSQLCollectionType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLCollectionType) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) PLSQLCollection(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection)

Example 7 with ArgumentType

use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.

the class OracleHelper method buildDbArtifacts.

@Override
public void buildDbArtifacts() {
    super.buildDbArtifacts();
    // list of all directly-referenced packages
    Set<PLSQLPackageType> directPackages = new HashSet<PLSQLPackageType>();
    for (ProcedureType procedureType : dbStoredProcedures) {
        for (ArgumentType argumentType : procedureType.getArguments()) {
            DatabaseType argumentDataType = argumentType.getEnclosedType();
            if (argumentDataType.isPLSQLType()) {
                PLSQLType plsqlType = (PLSQLType) argumentDataType;
                directPackages.add(plsqlType.getParentType());
            }
        }
    }
    // any indirectly-referenced packages?
    final Set<PLSQLPackageType> indirectPackages = new HashSet<PLSQLPackageType>();
    DatabaseTypeVisitor indirectVisitor = new BaseDatabaseTypeVisitor() {

        @Override
        public void beginVisit(PLSQLPackageType databaseType) {
            indirectPackages.add(databaseType);
        }
    };
    for (PLSQLPackageType pckage : directPackages) {
        pckage.accept(indirectVisitor);
    }
    Set<PLSQLPackageType> packages = new HashSet<PLSQLPackageType>();
    packages.addAll(directPackages);
    packages.addAll(indirectPackages);
    for (PLSQLPackageType pckage : packages) {
        ShadowDDLGenerator ddlGenerator = new ShadowDDLGenerator(pckage);
        dbwsBuilder.getTypeDDL().addAll(ddlGenerator.getAllCreateDDLs());
        dbwsBuilder.getTypeDropDDL().addAll(ddlGenerator.getAllDropDDLs());
    }
}
Also used : BaseDatabaseTypeVisitor(org.eclipse.persistence.tools.oracleddl.metadata.visit.BaseDatabaseTypeVisitor) ProcedureType(org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType) PLSQLPackageType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType) CompositeDatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType) ComplexDatabaseType(org.eclipse.persistence.internal.helper.ComplexDatabaseType) DatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType) Util.getAttributeClassForDatabaseType(org.eclipse.persistence.tools.dbws.Util.getAttributeClassForDatabaseType) BaseDatabaseTypeVisitor(org.eclipse.persistence.tools.oracleddl.metadata.visit.BaseDatabaseTypeVisitor) DatabaseTypeVisitor(org.eclipse.persistence.tools.oracleddl.metadata.visit.DatabaseTypeVisitor) ArgumentType(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType) PLSQLType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLType) HashSet(java.util.HashSet)

Example 8 with ArgumentType

use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.

the class JDBCHelper method loadProcedures.

protected List<ProcedureType> loadProcedures(String originalCatalogPattern, String originalSchemaPattern, String originalProcedurePattern) {
    List<ProcedureType> dbStoredProcedures = null;
    boolean catalogMatchDontCare = false;
    DatabasePlatform platform = dbwsBuilder.getDatabasePlatform();
    if (platform instanceof MySQLPlatform || platform instanceof DerbyPlatform || platform instanceof PostgreSQLPlatform) {
        // note that get info on other platforms that also require catalogMatchDontCare = true
        catalogMatchDontCare = true;
    }
    String catalogPattern = escapePunctuation(originalCatalogPattern);
    String schemaPattern = escapePunctuation(originalSchemaPattern);
    String procedurePattern = escapePunctuation(originalProcedurePattern);
    // Make sure procedure(s) is/are available
    ResultSet procsInfo = null;
    try {
        DatabaseMetaData databaseMetaData = getDatabaseMetaData(dbwsBuilder.getConnection());
        procsInfo = databaseMetaData.getProcedures(catalogPattern, schemaPattern, procedurePattern);
        // did we get a hit?
        if (procsInfo != null) {
            List<ProcedureType> tmpProcs = new ArrayList<ProcedureType>();
            while (procsInfo.next()) {
                String actualCatalogName = procsInfo.getString(PROCS_INFO_CATALOG);
                String actualSchemaName = procsInfo.getString(PROCS_INFO_SCHEMA);
                String actualProcedureName = procsInfo.getString(PROCS_INFO_NAME);
                short procedureType = procsInfo.getShort(PROCS_INFO_TYPE);
                ProcedureType dbStoredProcedure;
                if (procedureType == procedureReturnsResult) {
                    dbStoredProcedure = new FunctionType(actualProcedureName);
                } else {
                    dbStoredProcedure = new ProcedureType(actualProcedureName);
                }
                if (actualCatalogName != null && actualCatalogName.length() > 0) {
                    dbStoredProcedure.setCatalogName(actualCatalogName);
                }
                if (actualSchemaName != null && actualSchemaName.length() > 0) {
                    dbStoredProcedure.setSchema(actualSchemaName);
                }
                tmpProcs.add(dbStoredProcedure);
            }
            procsInfo.close();
            /* new a temp bucket to hold DbStoredArgs until they can be sorted out with respect
                 * to which DbStoredProcedure owns which args; this has to be done because Oracle can
                 * return multiple hits across multiple packages for the same procedureName.
                 */
            int numProcs = tmpProcs.size();
            if (numProcs > 0) {
                dbStoredProcedures = new ArrayList<ProcedureType>(numProcs);
                ResultSet procedureColumnsInfo = null;
                procedureColumnsInfo = databaseMetaData.getProcedureColumns(catalogPattern, schemaPattern, procedurePattern, "%");
                while (procedureColumnsInfo.next()) {
                    String actualCatalogName = procedureColumnsInfo.getString(PROC_COLS_INFO_CATALOG);
                    String actualSchemaName = procedureColumnsInfo.getString(PROC_COLS_INFO_SCHEMA);
                    String actualProcedureName = procedureColumnsInfo.getString(PROC_COLS_INFO_NAME);
                    String argName = procedureColumnsInfo.getString(PROC_COLS_INFO_COLNAME);
                    // some MySql drivers return empty string, some return null: set to emptyString regardless
                    if (argName == null) {
                        argName = "";
                    }
                    ArgumentType dbStoredArgument = new ArgumentType(argName);
                    short inOut = procedureColumnsInfo.getShort(PROC_COLS_INFO_TYPE);
                    if (inOut == procedureColumnInOut) {
                        dbStoredArgument.setDirection(INOUT);
                    } else if (inOut == procedureColumnOut) {
                        dbStoredArgument.setDirection(OUT);
                    } else if (inOut == procedureColumnReturn) {
                        dbStoredArgument.setDirection(RETURN);
                    } else {
                        // default to ArgumentTypeDirection.IN
                        dbStoredArgument.setDirection(IN);
                    }
                    int jdbcType = procedureColumnsInfo.getInt(PROC_COLS_INFO_DATA_TYPE);
                    int precision = procedureColumnsInfo.getInt(PROC_COLS_INFO_PRECISION);
                    int scale = procedureColumnsInfo.getInt(PROC_COLS_INFO_SCALE);
                    dbStoredArgument.setEnclosedType(buildTypeForJDBCType(jdbcType, precision, scale));
                    // find matching DbStoredProcedure
                    // this dbStoredArgument belongs to a 'regular' procedure
                    ProcedureType matchingProc = null;
                    for (int i = 0; i < tmpProcs.size(); ) {
                        ProcedureType tmpProc = tmpProcs.get(i);
                        if (matches(tmpProc, actualCatalogName, actualSchemaName, actualProcedureName, false, catalogMatchDontCare)) {
                            matchingProc = tmpProc;
                            dbStoredProcedures.add(matchingProc);
                            break;
                        }
                        i++;
                    }
                    if (matchingProc == null) {
                        // look in dbStoredProcedures - matching proc already moved over ?
                        for (ProcedureType dbStoredProcedure : dbStoredProcedures) {
                            if (matches(dbStoredProcedure, actualCatalogName, actualSchemaName, actualProcedureName, false, catalogMatchDontCare)) {
                                matchingProc = dbStoredProcedure;
                                break;
                            }
                        }
                    }
                    if (matchingProc != null) {
                        if (matchingProc.isFunctionType() && dbStoredArgument.getArgumentName().equalsIgnoreCase("")) {
                            ((FunctionType) matchingProc).setReturnArgument(dbStoredArgument);
                        } else {
                            matchingProc.getArguments().add(dbStoredArgument);
                        }
                        tmpProcs.remove(matchingProc);
                    }
                // else some argument that doesn't have a matching proc? ignore for now
                }
                procedureColumnsInfo.close();
                if (!tmpProcs.isEmpty()) {
                    // leftovers are the no-arg procedures
                    dbStoredProcedures.addAll(tmpProcs);
                }
            }
        }
    } catch (SQLException sqlException) {
        throw new IllegalStateException("failure retrieving Stored Procedure metadata", sqlException);
    }
    if (dbStoredProcedures != null && !dbStoredProcedures.isEmpty()) {
        Collections.sort(dbStoredProcedures, new Comparator<ProcedureType>() {

            @Override
            public int compare(ProcedureType o1, ProcedureType o2) {
                String name1 = o1.getProcedureName();
                String name2 = o2.getProcedureName();
                if (!name1.equals(name2)) {
                    return name1.compareTo(name2);
                } else {
                    return o1.getOverload() - o2.getOverload();
                }
            }
        });
    }
    return dbStoredProcedures;
}
Also used : PostgreSQLPlatform(org.eclipse.persistence.platform.database.PostgreSQLPlatform) ProcedureType(org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType) SQLException(java.sql.SQLException) FunctionType(org.eclipse.persistence.tools.oracleddl.metadata.FunctionType) ArrayList(java.util.ArrayList) DatabasePlatform(org.eclipse.persistence.internal.databaseaccess.DatabasePlatform) Util.qNameFromString(org.eclipse.persistence.tools.dbws.Util.qNameFromString) DatabaseMetaData(java.sql.DatabaseMetaData) ArgumentType(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType) DerbyPlatform(org.eclipse.persistence.platform.database.DerbyPlatform) ResultSet(java.sql.ResultSet) MySQLPlatform(org.eclipse.persistence.platform.database.MySQLPlatform)

Example 9 with ArgumentType

use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.

the class JDBCHelper method buildProcedureOperation.

@Override
public void buildProcedureOperation(ProcedureOperationModel procedureOperationModel) {
    String name = procedureOperationModel.getName();
    boolean isMySQL = dbwsBuilder.getDatabasePlatform().getClass().getName().contains("MySQL");
    for (ProcedureType storedProcedure : procedureOperationModel.getDbStoredProcedures()) {
        StringBuilder sb = new StringBuilder();
        if (name == null || name.length() == 0) {
            if (storedProcedure.getOverload() > 0) {
                sb.append(storedProcedure.getOverload());
                sb.append('_');
            }
            if (storedProcedure.getCatalogName() != null && storedProcedure.getCatalogName().length() > 0) {
                sb.append(storedProcedure.getCatalogName());
                sb.append('_');
            }
            if (storedProcedure.getSchema() != null && storedProcedure.getSchema().length() > 0) {
                sb.append(storedProcedure.getSchema());
                sb.append('_');
            }
            sb.append(storedProcedure.getProcedureName());
        } else {
            sb.append(name);
        }
        QueryOperation qo = new QueryOperation();
        qo.setName(sb.toString());
        QueryHandler qh;
        if (storedProcedure.isFunctionType()) {
            qh = new StoredFunctionQueryHandler();
        } else {
            qh = new StoredProcedureQueryHandler();
        }
        sb = new StringBuilder();
        if (!isMySQL) {
            if (storedProcedure.getCatalogName() != null && storedProcedure.getCatalogName().length() > 0) {
                sb.append(storedProcedure.getCatalogName());
                sb.append('.');
            }
        }
        if (storedProcedure.getSchema() != null && storedProcedure.getSchema().length() > 0) {
            sb.append(storedProcedure.getSchema());
            sb.append('.');
        }
        sb.append(storedProcedure.getProcedureName());
        ((StoredProcedureQueryHandler) qh).setName(sb.toString());
        dbwsBuilder.logMessage(FINEST, "Building QueryOperation for " + sb.toString());
        // before assigning queryHandler, check for named query in OR project
        List<DatabaseQuery> queries = dbwsBuilder.getOrProject().getQueries();
        if (queries.size() > 0) {
            for (DatabaseQuery q : queries) {
                if (q.getName().equals(qo.getName())) {
                    qh = new NamedQueryHandler();
                    ((NamedQueryHandler) qh).setName(qo.getName());
                }
            }
        }
        qo.setQueryHandler(qh);
        String returnType = procedureOperationModel.getReturnType();
        boolean isCollection = procedureOperationModel.isCollection();
        boolean isSimpleXMLFormat = procedureOperationModel.isSimpleXMLFormat();
        Result result = null;
        if (storedProcedure.isFunctionType()) {
            FunctionType storedFunction = (FunctionType) storedProcedure;
            DatabaseType rarg = storedFunction.getReturnArgument();
            if (rarg.getTypeName().contains("CURSOR")) {
                result = new CollectionResult();
                result.setType(SXF_QNAME_CURSOR);
            } else {
                result = new Result();
                int rargJdbcType = Util.getJDBCTypeFromTypeName(rarg.getTypeName());
                switch(rargJdbcType) {
                    case STRUCT:
                    case ARRAY:
                    case OTHER:
                        if (returnType != null) {
                            result.setType(buildCustomQName(returnType, dbwsBuilder));
                        } else {
                            result.setType(ANY_QNAME);
                        }
                        break;
                    default:
                        result.setType(getXMLTypeFromJDBCType(rargJdbcType));
                        break;
                }
            }
        } else {
            // if user overrides returnType, assume they're right
            if (returnType != null) {
                result = new Result();
                result.setType(buildCustomQName(returnType, dbwsBuilder));
            } else {
                if (isCollection) {
                    result = new CollectionResult();
                    if (isSimpleXMLFormat) {
                        result.setType(SXF_QNAME_CURSOR);
                    }
                } else {
                    result = new Result();
                    result.setType(SXF_QNAME);
                }
            }
        }
        if (procedureOperationModel.getBinaryAttachment()) {
            Attachment attachment = new Attachment();
            attachment.setMimeType("application/octet-stream");
            result.setAttachment(attachment);
        }
        for (ArgumentType arg : storedProcedure.getArguments()) {
            String argName = arg.getArgumentName();
            if (argName != null) {
                ProcedureArgument pa = null;
                Parameter parm = null;
                ArgumentTypeDirection direction = arg.getDirection();
                QName xmlType = null;
                switch(Util.getJDBCTypeFromTypeName(arg.getTypeName())) {
                    case STRUCT:
                    case ARRAY:
                    case OTHER:
                        String typeString = nct.generateSchemaAlias(arg.getTypeName());
                        xmlType = buildCustomQName(typeString, dbwsBuilder);
                        break;
                    default:
                        xmlType = getXMLTypeFromJDBCType(Util.getJDBCTypeFromTypeName(arg.getTypeName()));
                        break;
                }
                if (direction == IN) {
                    parm = new Parameter();
                    parm.setName(argName);
                    parm.setType(xmlType);
                    pa = new ProcedureArgument();
                    pa.setName(argName);
                    pa.setParameterName(argName);
                    if (qh instanceof StoredProcedureQueryHandler) {
                        ((StoredProcedureQueryHandler) qh).getInArguments().add(pa);
                    }
                } else {
                    // the first OUT/INOUT arg determines singleResult vs. collectionResult
                    pa = new ProcedureOutputArgument();
                    ProcedureOutputArgument pao = (ProcedureOutputArgument) pa;
                    pao.setName(argName);
                    pao.setParameterName(argName);
                    if (arg.getTypeName().contains("CURSOR") && returnType == null) {
                        // if user overrides returnType, assume they're right
                        pao.setResultType(SXF_QNAME_CURSOR);
                        if (result == null) {
                            result = new CollectionResult();
                            result.setType(SXF_QNAME_CURSOR);
                        }
                    } else {
                        // Hmm, multiple OUT's gonna be a problem - later!
                        if (returnType != null && !isSimpleXMLFormat) {
                            xmlType = qNameFromString("{" + dbwsBuilder.getTargetNamespace() + "}" + returnType, dbwsBuilder.getSchema());
                        }
                        pao.setResultType(xmlType);
                        if (result == null) {
                            if (isCollection) {
                                result = new CollectionResult();
                            } else {
                                result = new Result();
                            }
                            result.setType(xmlType);
                        }
                    }
                    if (direction == INOUT) {
                        parm = new Parameter();
                        parm.setName(argName);
                        parm.setType(xmlType);
                        result.setType(xmlType);
                        // use of INOUT precludes SimpleXMLFormat
                        isSimpleXMLFormat = false;
                        if (qh instanceof StoredProcedureQueryHandler) {
                            ((StoredProcedureQueryHandler) qh).getInOutArguments().add(pao);
                        }
                    } else {
                        if (qh instanceof StoredProcedureQueryHandler) {
                            ((StoredProcedureQueryHandler) qh).getOutArguments().add(pao);
                        }
                    }
                }
                if (parm != null) {
                    qo.getParameters().add(parm);
                }
            }
        }
        handleSimpleXMLFormat(isSimpleXMLFormat, result, procedureOperationModel);
        qo.setResult(result);
        dbwsBuilder.getXrServiceModel().getOperations().put(qo.getName(), qo);
    }
    finishProcedureOperation();
}
Also used : ProcedureType(org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType) StoredProcedureQueryHandler(org.eclipse.persistence.internal.xr.StoredProcedureQueryHandler) StoredFunctionQueryHandler(org.eclipse.persistence.internal.xr.StoredFunctionQueryHandler) QueryHandler(org.eclipse.persistence.internal.xr.QueryHandler) NamedQueryHandler(org.eclipse.persistence.internal.xr.NamedQueryHandler) CompositeDatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType) DatabaseType(org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType) DatabaseQuery(org.eclipse.persistence.queries.DatabaseQuery) Util.buildCustomQName(org.eclipse.persistence.tools.dbws.Util.buildCustomQName) QName(javax.xml.namespace.QName) FunctionType(org.eclipse.persistence.tools.oracleddl.metadata.FunctionType) StoredProcedureQueryHandler(org.eclipse.persistence.internal.xr.StoredProcedureQueryHandler) Attachment(org.eclipse.persistence.internal.xr.Attachment) Util.qNameFromString(org.eclipse.persistence.tools.dbws.Util.qNameFromString) ArgumentType(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType) ProcedureArgument(org.eclipse.persistence.internal.xr.ProcedureArgument) ProcedureOutputArgument(org.eclipse.persistence.internal.xr.ProcedureOutputArgument) CollectionResult(org.eclipse.persistence.internal.xr.CollectionResult) Result(org.eclipse.persistence.internal.xr.Result) DatabaseMetaData.procedureReturnsResult(java.sql.DatabaseMetaData.procedureReturnsResult) StoredFunctionQueryHandler(org.eclipse.persistence.internal.xr.StoredFunctionQueryHandler) CollectionResult(org.eclipse.persistence.internal.xr.CollectionResult) NamedQueryHandler(org.eclipse.persistence.internal.xr.NamedQueryHandler) Parameter(org.eclipse.persistence.internal.xr.Parameter) QueryOperation(org.eclipse.persistence.internal.xr.QueryOperation) ArgumentTypeDirection(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentTypeDirection)

Example 10 with ArgumentType

use of org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType in project eclipselink by eclipse-ee4j.

the class OracleHelper method buildProcedureOperation.

/**
 * Builds query operations for a given ProcedureOperationModel.
 */
@Override
public void buildProcedureOperation(ProcedureOperationModel procedureOperationModel) {
    for (ProcedureType storedProcedure : procedureOperationModel.getDbStoredProcedures()) {
        boolean hasComplexArgs = hasComplexArgs(storedProcedure);
        QueryOperation qo = new QueryOperation();
        qo.setName(getNameForQueryOperation(procedureOperationModel, storedProcedure));
        String qualifiedProcName = getQualifiedProcedureName(procedureOperationModel, storedProcedure);
        dbwsBuilder.logMessage(FINEST, BUILDING_QUERYOP_FOR + qualifiedProcName);
        QueryHandler qh = null;
        // before assigning queryHandler, check for named query in OR project
        List<DatabaseQuery> queries = dbwsBuilder.getOrProject().getQueries();
        if (queries.size() > 0) {
            for (DatabaseQuery q : queries) {
                if (q.getName().equals(qo.getName())) {
                    qh = new NamedQueryHandler();
                    ((NamedQueryHandler) qh).setName(qo.getName());
                }
            }
        }
        if (qh == null) {
            if (storedProcedure.isFunctionType()) {
                qh = new StoredFunctionQueryHandler();
            } else {
                qh = new StoredProcedureQueryHandler();
            }
            ((StoredProcedureQueryHandler) qh).setName(qualifiedProcName);
        }
        qo.setQueryHandler(qh);
        String returnType = procedureOperationModel.getReturnType();
        boolean isCollection = procedureOperationModel.isCollection();
        boolean isSimpleXMLFormat = procedureOperationModel.isSimpleXMLFormat();
        Result result = null;
        /**
         * For multiple OUT args as well as a stored function with OUT args, we want
         * the result to be a collection and the type to be "xsd:any".  We will
         * force SimpleXMLFormat for now as well.
         */
        int outArgCount = 0;
        for (ArgumentType argument : storedProcedure.getArguments()) {
            ArgumentTypeDirection argDirection = argument.getDirection();
            if (argDirection == OUT) {
                outArgCount++;
            }
        }
        if (outArgCount > 1 || (outArgCount > 0 && storedProcedure.isFunctionType())) {
            isCollection = true;
            isSimpleXMLFormat = true;
            result = new CollectionResult();
            result.setType(ANY_QNAME);
        } else {
            if (storedProcedure.isFunctionType()) {
                ArgumentType returnArg = ((FunctionType) storedProcedure).getReturnArgument();
                result = buildResultForStoredFunction(returnArg, returnType);
                // tags to better represent the PL/SQL record/table/column type
                if (returnArg.getEnclosedType().isPLSQLCursorType()) {
                    customizeSimpleXMLTagNames((PLSQLCursorType) returnArg.getEnclosedType(), procedureOperationModel);
                }
            } else if (hasComplexArgs) {
                if (Util.noOutArguments(storedProcedure)) {
                    result = new Result();
                    // rowcount
                    result.setType(new QName(SCHEMA_URL, INT, SCHEMA_PREFIX));
                }
            } else {
                // if user overrides returnType, assume they're right
                if (returnType != null) {
                    result = new Result();
                    result.setType(buildCustomQName(returnType, dbwsBuilder));
                } else {
                    if (isCollection) {
                        result = new CollectionResult();
                        if (isSimpleXMLFormat) {
                            result.setType(SXF_QNAME_CURSOR);
                        }
                    } else {
                        result = new Result();
                        result.setType(SXF_QNAME);
                    }
                }
            }
        }
        for (ArgumentType arg : storedProcedure.getArguments()) {
            String argName = arg.getArgumentName();
            if (argName != null) {
                QName xmlType = null;
                ProcedureArgument pa = null;
                // for INOUT's
                ProcedureArgument paShadow = null;
                Parameter parm = null;
                ArgumentTypeDirection direction = arg.getDirection();
                if (!hasComplexArgs) {
                    if (arg.getEnclosedType().isPLSQLCursorType()) {
                        PLSQLCursorType cursorType = (PLSQLCursorType) arg.getEnclosedType();
                        if (cursorType.isWeaklyTyped()) {
                            xmlType = buildCustomQName("SYS_REFCURSOR", dbwsBuilder);
                        }
                    } else {
                        xmlType = getXMLTypeFromJDBCType(Util.getJDBCTypeFromTypeName(arg.getTypeName()));
                    }
                } else {
                    // handle PL/SQL records and collections
                    if (arg.getEnclosedType().isPLSQLType()) {
                        String packageName = ((PLSQLType) arg.getEnclosedType()).getParentType().getPackageName();
                        // may need to prepend package name
                        String typeString = (packageName != null && packageName.length() > 0) ? packageName + UNDERSCORE + arg.getTypeName() : arg.getTypeName();
                        // may need to strip off %
                        typeString = typeString.contains(PERCENT) ? typeString.replace(PERCENT, UNDERSCORE) : typeString;
                        xmlType = buildCustomQName(nct.generateSchemaAlias(typeString), dbwsBuilder);
                    } else if (arg.getEnclosedType().isVArrayType() || arg.getEnclosedType().isObjectType() || arg.getEnclosedType().isObjectTableType()) {
                        // handle advanced JDBC types
                        xmlType = buildCustomQName(nct.generateSchemaAlias(arg.getTypeName()), dbwsBuilder);
                    } else {
                        switch(Util.getJDBCTypeFromTypeName(arg.getTypeName())) {
                            case STRUCT:
                            case ARRAY:
                                String typeString = nct.generateSchemaAlias(arg.getTypeName());
                                xmlType = buildCustomQName(typeString, dbwsBuilder);
                                break;
                            default:
                                xmlType = getXMLTypeFromJDBCType(Util.getJDBCTypeFromTypeName(arg.getTypeName()));
                                break;
                        }
                    }
                }
                if (direction == null || direction == IN) {
                    parm = new Parameter();
                    parm.setName(argName);
                    parm.setType(xmlType);
                    // handle optional arg
                    parm.setOptional(arg.optional());
                    pa = new ProcedureArgument();
                    pa.setName(argName);
                    pa.setParameterName(argName);
                    if (qh instanceof StoredProcedureQueryHandler) {
                        ((StoredProcedureQueryHandler) qh).getInArguments().add(pa);
                    }
                } else {
                    // the first OUT/INOUT arg determines singleResult vs. collectionResult
                    pa = new ProcedureOutputArgument();
                    ProcedureOutputArgument pao = (ProcedureOutputArgument) pa;
                    pao.setName(argName);
                    pao.setParameterName(argName);
                    boolean isCursor = arg.isPLSQLCursorType() || arg.getTypeName().contains(CURSOR_STR);
                    // tags to better represent the PL/SQL record/table/column type
                    if (arg.isPLSQLCursorType()) {
                        customizeSimpleXMLTagNames((PLSQLCursorType) arg.getEnclosedType(), procedureOperationModel);
                    }
                    if (isCursor && returnType == null) {
                        // if user overrides returnType, assume they're right
                        pao.setResultType(SXF_QNAME_CURSOR);
                        if (result == null) {
                            result = new CollectionResult();
                            result.setType(SXF_QNAME_CURSOR);
                        }
                    } else {
                        // Hmm, multiple OUT's gonna be a problem - later!
                        if (returnType != null && !isSimpleXMLFormat) {
                            xmlType = qNameFromString(OPEN_PAREN + dbwsBuilder.getTargetNamespace() + CLOSE_PAREN + returnType, dbwsBuilder.getSchema());
                        }
                        if (isCursor) {
                            pao.setResultType(new QName(EMPTY_STRING, CURSOR_OF_STR + returnType));
                            Result newResult = new CollectionResult();
                            newResult.setType(result.getType());
                            result = newResult;
                        } else {
                            pao.setResultType(xmlType);
                        }
                        if (result == null) {
                            if (isCollection) {
                                result = new CollectionResult();
                            } else {
                                result = new Result();
                            }
                            result.setType(xmlType);
                        }
                    }
                    if (direction == INOUT) {
                        parm = new Parameter();
                        parm.setName(argName);
                        parm.setType(xmlType);
                        result.setType(xmlType);
                        if (qh instanceof StoredProcedureQueryHandler) {
                            ((StoredProcedureQueryHandler) qh).getInOutArguments().add(pao);
                        }
                        paShadow = new ProcedureArgument();
                        paShadow.setName(argName);
                        paShadow.setParameterName(argName);
                    } else {
                        // OUT arg
                        if (qh instanceof StoredProcedureQueryHandler) {
                            ((StoredProcedureQueryHandler) qh).getOutArguments().add(pao);
                        }
                    }
                }
                // for XMLType, we want the type code to be 'OPAQUE' (2007)
                if (arg.getEnclosedType() == ScalarDatabaseTypeEnum.XMLTYPE_TYPE) {
                    pa.setJdbcType(getJDBCTypeForTypeName(XMLTYPE_STR));
                }
                if (hasComplexArgs && arg.getEnclosedType().isPLSQLType()) {
                    pa.setComplexTypeName(storedProcedure.getCatalogName() + UNDERSCORE + arg.getTypeName());
                    if (paShadow != null) {
                        paShadow.setComplexTypeName(pa.getComplexTypeName());
                    }
                }
                if (parm != null) {
                    qo.getParameters().add(parm);
                }
            }
        }
        if (procedureOperationModel.getBinaryAttachment()) {
            Attachment attachment = new Attachment();
            attachment.setMimeType(APP_OCTET_STREAM);
            result.setAttachment(attachment);
        }
        // the user may want simpleXMLFormat
        handleSimpleXMLFormat(isSimpleXMLFormat, result, procedureOperationModel);
        qo.setResult(result);
        dbwsBuilder.getXrServiceModel().getOperations().put(qo.getName(), qo);
    }
    finishProcedureOperation();
}
Also used : ProcedureType(org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType) StoredProcedureQueryHandler(org.eclipse.persistence.internal.xr.StoredProcedureQueryHandler) StoredFunctionQueryHandler(org.eclipse.persistence.internal.xr.StoredFunctionQueryHandler) QueryHandler(org.eclipse.persistence.internal.xr.QueryHandler) NamedQueryHandler(org.eclipse.persistence.internal.xr.NamedQueryHandler) DatabaseQuery(org.eclipse.persistence.queries.DatabaseQuery) Util.buildCustomQName(org.eclipse.persistence.tools.dbws.Util.buildCustomQName) QName(javax.xml.namespace.QName) FunctionType(org.eclipse.persistence.tools.oracleddl.metadata.FunctionType) StoredProcedureQueryHandler(org.eclipse.persistence.internal.xr.StoredProcedureQueryHandler) PLSQLCursorType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLCursorType) Attachment(org.eclipse.persistence.internal.xr.Attachment) Util.qNameFromString(org.eclipse.persistence.tools.dbws.Util.qNameFromString) ArgumentType(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType) ProcedureArgument(org.eclipse.persistence.internal.xr.ProcedureArgument) ProcedureOutputArgument(org.eclipse.persistence.internal.xr.ProcedureOutputArgument) CollectionResult(org.eclipse.persistence.internal.xr.CollectionResult) Result(org.eclipse.persistence.internal.xr.Result) StoredFunctionQueryHandler(org.eclipse.persistence.internal.xr.StoredFunctionQueryHandler) CollectionResult(org.eclipse.persistence.internal.xr.CollectionResult) NamedQueryHandler(org.eclipse.persistence.internal.xr.NamedQueryHandler) Parameter(org.eclipse.persistence.internal.xr.Parameter) QueryOperation(org.eclipse.persistence.internal.xr.QueryOperation) ArgumentTypeDirection(org.eclipse.persistence.tools.oracleddl.metadata.ArgumentTypeDirection)

Aggregations

ArgumentType (org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType)10 ArrayList (java.util.ArrayList)7 ProcedureType (org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType)5 Util.qNameFromString (org.eclipse.persistence.tools.dbws.Util.qNameFromString)4 CompositeDatabaseType (org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType)4 DatabaseQuery (org.eclipse.persistence.queries.DatabaseQuery)3 ArgumentTypeDirection (org.eclipse.persistence.tools.oracleddl.metadata.ArgumentTypeDirection)3 DatabaseType (org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType)3 FunctionType (org.eclipse.persistence.tools.oracleddl.metadata.FunctionType)3 QName (javax.xml.namespace.QName)2 ComplexDatabaseType (org.eclipse.persistence.internal.helper.ComplexDatabaseType)2 PLSQLParameterMetadata (org.eclipse.persistence.internal.jpa.metadata.queries.PLSQLParameterMetadata)2 StoredProcedureParameterMetadata (org.eclipse.persistence.internal.jpa.metadata.queries.StoredProcedureParameterMetadata)2 Attachment (org.eclipse.persistence.internal.xr.Attachment)2 CollectionResult (org.eclipse.persistence.internal.xr.CollectionResult)2 NamedQueryHandler (org.eclipse.persistence.internal.xr.NamedQueryHandler)2 Parameter (org.eclipse.persistence.internal.xr.Parameter)2 ProcedureArgument (org.eclipse.persistence.internal.xr.ProcedureArgument)2 ProcedureOutputArgument (org.eclipse.persistence.internal.xr.ProcedureOutputArgument)2 QueryHandler (org.eclipse.persistence.internal.xr.QueryHandler)2