/** * PUBLIC: * Define the output argument to the stored procedure and the field/argument name to be substitute for it. * The procedureParameterAndArgumentFieldName is the name of the procedure argument expected, * and is the field or argument name to be used to pass to the procedure. * These names are assumed to be the same, if not this method can be called with two arguments. */ public void addNamedOutputArgument(String procedureParameterAndArgumentFieldName) { addNamedOutputArgument(procedureParameterAndArgumentFieldName, procedureParameterAndArgumentFieldName); }
/** * PUBLIC: * Define the field/argument name to be substitute for the index output argument. * This method is used if the procedure is not named and the order is explicit, names must be added in the correct order. * The argumentFieldName is the field or argument name to be used is the result of the output row. * The jdbcType is the JDBC type code, this dependent on the type returned from the procedure. * 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 addUnamedOutputArgument(String argumentFieldName, int jdbcType, String typeName, Class javaType) { addNamedOutputArgument(null, argumentFieldName, jdbcType, typeName, javaType, null); }
/** * PUBLIC: * Define the output argument to the stored procedure and the field/argument name to be substitute for it. * The procedureParameterAndArgumentFieldName is the name of the procedure argument expected, * and is the field or argument name to be used to pass to the procedure. * These names are assumed to be the same, if not this method can be called with two arguments. */ public void addNamedOutputArgument(String procedureParameterAndArgumentFieldName) { addNamedOutputArgument(procedureParameterAndArgumentFieldName, procedureParameterAndArgumentFieldName); }
/** * PUBLIC: * Define the field/argument name to be substitute for the index output argument. * This method is used if the procedure is not named and the order is explicit, names must be added in the correct order. * The argumentFieldName is the field or argument name to be used is the result of the output row. * The jdbcType is the JDBC type code, this dependent on the type returned from the procedure. * 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 addUnamedOutputArgument(String argumentFieldName, int jdbcType, String typeName, Class javaType) { addNamedOutputArgument(null, argumentFieldName, jdbcType, typeName, javaType, null); }
/** * PUBLIC: * Define the output argument to the stored procedure and the field/argument name to be substitute for it. * The procedureParameterAndArgumentFieldName is the name of the procedure argument expected, * and is the field or argument name to be used to pass to the procedure. * These names are assumed to be the same, if not this method can be called with two arguments. */ public void addNamedOutputArgument(String procedureParameterAndArgumentFieldName) { addNamedOutputArgument(procedureParameterAndArgumentFieldName, procedureParameterAndArgumentFieldName); }
/** * PUBLIC: * Define the field/argument name to be substitute for the index output argument. * This method is used if the procedure is not named and the order is explicit, names must be added in the correct order. * The argumentFieldName is the field or argument name to be used is the result of the output row. * The jdbcType is the JDBC type code, this dependent on the type returned from the procedure. * 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 addUnamedOutputArgument(String argumentFieldName, int jdbcType, String typeName, Class javaType) { addNamedOutputArgument(null, argumentFieldName, jdbcType, typeName, javaType, null); }
/** * PUBLIC: * Define the field/argument name to be substitute for the index output argument. * This method is used if the procedure is not named and the order is explicit, names must be added in the correct order. * The argumentFieldName is the field or argument name to be used is the result of the output row. * The jdbcType is the JDBC type code, this dependent on the type returned from the procedure. * 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. * The nestedType is a DatabaseField with type information set to match the VARRAYs object types */ public void addUnamedOutputArgument(String argumentFieldName, int jdbcType, String typeName, Class javaType, DatabaseField nestedType) { addNamedOutputArgument(null, argumentFieldName, jdbcType, typeName, javaType, nestedType); }
/** * PUBLIC: * Define the field/argument name to be substitute for the index output argument. * This method is used if the procedure is not named and the order is explicit, names must be added in the correct order. * The argumentFieldName is the field or argument name to be used is the result of the output row. * The jdbcType is the JDBC type code, this dependent on the type returned from the procedure. * 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. * The nestedType is a DatabaseField with type information set to match the VARRAYs object types */ public void addUnamedOutputArgument(String argumentFieldName, int jdbcType, String typeName, Class javaType, DatabaseField nestedType) { addNamedOutputArgument(null, argumentFieldName, jdbcType, typeName, javaType, nestedType); }
/** * PUBLIC: * Define the field/argument name to be substitute for the index output argument. * This method is used if the procedure is not named and the order is explicit, names must be added in the correct order. * The argumentFieldName is the field or argument name to be used is the result of the output row. * The jdbcType is the JDBC type code, this dependent on the type returned from the procedure. * 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. * The nestedType is a DatabaseField with type information set to match the VARRAYs object types */ public void addUnamedOutputArgument(String argumentFieldName, int jdbcType, String typeName, Class javaType, DatabaseField nestedType) { addNamedOutputArgument(null, argumentFieldName, jdbcType, typeName, javaType, nestedType); }
StoredProcedureCall storedProcedureCall = new StoredProcedureCall(); storedProcedureCall.setProcedureName("mypackage.myprocedure"); storedProcedureCall.addNamedArgument("i_input_1"); // Add input argument name. storedProcedureCall.addNamedOutputArgument("o_output_1"); // Add output parameter name. DataReadQuery query = new DataReadQuery(); query.setCall(storedProcedureCall); query.addArgument("i_input_1"); // Add input argument names (again); List<Object> argumentValues = new ArrayList<Object>(); argumentValues.add("valueOf_i_input_1"); // Add input argument values. JpaEntityManager jpaEntityManager = (JpaEntityManager) getEntityManager(); Session session = jpaEntityManager.getActiveSession(); List<?> results = (List<?>) session.executeQuery(query, argumentValues); DatabaseRecord record = (DatabaseRecord) results.get(0); String result = String.valueOf(record.get("o_output_1")); // Get output parameter
protected void setSingleResult(XRServiceAdapter xrService, StoredProcedureCall spCall, QName resultType) { if (getOutArguments().size() == 1) { ProcedureArgument arg = getOutArguments().get(0); // check query's returnType or arg's returnType if (isCursorType(xrService, resultType) || ( arg instanceof ProcedureOutputArgument && isCursorType(xrService, ((ProcedureOutputArgument)arg).getResultType()))) { spCall.useNamedCursorOutputAsResultSet(arg.getName()); } else { spCall.addNamedOutputArgument(arg.getName()); } } }
protected void setSingleResult(XRServiceAdapter xrService, StoredProcedureCall spCall, QName resultType) { if (getOutArguments().size() == 1) { ProcedureArgument arg = getOutArguments().get(0); // check query's returnType or arg's returnType if (isCursorType(xrService, resultType) || ( arg instanceof ProcedureOutputArgument && isCursorType(xrService, ((ProcedureOutputArgument)arg).getResultType()))) { spCall.useNamedCursorOutputAsResultSet(arg.getName()); } else { spCall.addNamedOutputArgument(arg.getName()); } } }
StoredProcedureCall call = new StoredProcedureCall(); call.setProcedureName("test"); call.addNamedArgument("p_year"); call.addNamedArgument("p_rel"); call.addNamedOutputArgument("p_data"); call.useNamedCursorOutputAsResultSet("p_resset"); @SuppressWarnings("rawtypes") List result= (List) s.executeQuery(query, args); DatabaseRecord record = (DatabaseRecord)results.get(0); String data = (String) record.get("p_data");
DatabaseType type = outArg.databaseType; if (!type.isComplexDatabaseType()) { super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode()); } else { ComplexDatabaseType complexType = (ComplexDatabaseType)type; 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()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), complexType.getCompatibleType(), complexType.getJavaType()); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode());
call.addNamedArgument(parameterName, parameterName, type); } else if (mode.equals(ParameterMode.OUT)) { call.addNamedOutputArgument(parameterName, parameterName, type); call.setCursorOrdinalPosition(parameterName, call.getParameters().size()); } else if (mode.equals(ParameterMode.INOUT)) {
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), type.getTypeName()); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode()); if (outArg.outIndex != MIN_VALUE) { if (complexType.isStruct()) { super.addNamedOutputArgument(outArg.name, outArg.name, complexType.getSqlCode(), complexType.getTypeName(), complexType.getJavaType()); } else if (complexType.isArray()) { DatabaseType nestedType = ((OracleArrayType) complexType).getNestedType(); nestedField.setSqlTypeName(complexNestedType.getCompatibleType()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getTypeName(), complexType.getJavaType(), nestedField); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getTypeName(), complexType.getJavaType()); nestedField.setSqlTypeName(complexNestedType.getCompatibleType()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType(), complexType.getJavaType(), nestedField); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType(), complexType.getJavaType()); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode());
super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode(), type.getTypeName()); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getConversionCode()); if (outArg.outIndex != MIN_VALUE) { if (complexType.isStruct()) { super.addNamedOutputArgument(outArg.name, outArg.name, complexType.getSqlCode(), complexType.getTypeName(), complexType.getJavaType()); } else if (complexType.isArray()) { DatabaseType nestedType = ((OracleArrayType) complexType).getNestedType(); nestedField.setSqlTypeName(complexNestedType.getCompatibleType()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getTypeName(), complexType.getJavaType(), nestedField); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getTypeName(), complexType.getJavaType()); nestedField.setSqlTypeName(complexNestedType.getCompatibleType()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType(), complexType.getJavaType(), nestedField); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType()); super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode(), complexType.getCompatibleType(), complexType.getJavaType()); } else { super.addNamedOutputArgument(outArg.name, outArg.name, type.getSqlCode());
OracleArrayTypeMetadata aType = null; if (hasTypeName() && (aType = getArrayTypeMetadata(m_typeName)) != null) { call.addNamedOutputArgument(m_name, m_queryParameter, m_jdbcType, m_jdbcTypeName, getJavaClass(m_type), buildNestedField(aType)); } else { call.addNamedOutputArgument(m_name, m_queryParameter, m_jdbcType, m_jdbcTypeName, getJavaClass(m_type)); call.addNamedOutputArgument(m_name, m_queryParameter, getJavaClass(m_type)); call.addUnamedOutputArgument(m_queryParameter, m_jdbcType, m_jdbcTypeName); } else { call.addNamedOutputArgument(m_name, m_queryParameter, m_jdbcType, m_jdbcTypeName); call.addUnamedOutputArgument(m_queryParameter, m_jdbcType); } else { call.addNamedOutputArgument(m_name, m_queryParameter, m_jdbcType); call.addUnamedOutputArgument(m_queryParameter); } else { call.addNamedOutputArgument(m_name, m_queryParameter);
spCall.addNamedOutputArgument(arg.getName(), arg.getName(), arg.getJdbcType(), getTypeNameForJDBCType(arg.getJdbcType())); } else { spCall.addNamedOutputArgument(arg.getName()); } else { if (arg.isJdbcTypeSet()) { spCall.addNamedOutputArgument(arg.getName(), arg.getName(), arg.getJdbcType(), getTypeNameForJDBCType(arg.getJdbcType())); } else { spCall.addNamedOutputArgument(arg.getName());
spCall.addNamedOutputArgument(arg.getName(), arg.getName(), arg.getJdbcType(), getTypeNameForJDBCType(arg.getJdbcType())); } else { spCall.addNamedOutputArgument(arg.getName()); } else { if (arg.isJdbcTypeSet()) { spCall.addNamedOutputArgument(arg.getName(), arg.getName(), arg.getJdbcType(), getTypeNameForJDBCType(arg.getJdbcType())); } else { spCall.addNamedOutputArgument(arg.getName());