/** * INTERNAL: * This method is a convenience method for extracting values from Results */ public Object getValueFromRecord(DatabaseRecord record, ResultSetMappingQuery query){ return record.get(this.column); }
/** * INTERNAL: * This method is a convenience method for extracting values from Results */ public Object getValueFromRecord(DatabaseRecord record){ return record.get(this.column); }
/** * INTERNAL: * This method is a convenience method for extracting values from Results */ public Object getValueFromRecord(DatabaseRecord record, ResultSetMappingQuery query){ return record.get(this.column); }
/** * INTERNAL: * This method is a convenience method for extracting values from Results */ public Object getValueFromRecord(DatabaseRecord record){ return record.get(this.column); }
/** * INTERNAL: * This method is a convience method for extracting values from Results */ public Object getValueFromRecord(DatabaseRecord record, ResultSetMappingQuery query){ return record.get(this.columnName); }
/** * INTERNAL: * This method is a convenience method for extracting values from Results */ public Object getValueFromRecord(DatabaseRecord record){ return record.get(this.columnName); }
/** * overrides get method to allow on-demand extraction. */ public Object get(Object key) { Object value = super.get(key); if (value instanceof CobolRedefinedFieldValue) { value = ((CobolRedefinedFieldValue)value).getValue(); } return value; }
/** * overrides get method to allow on-demand extraction. */ public Object get(DatabaseField key) { Object value = super.get(key); if (value instanceof CobolRedefinedFieldValue) { value = ((CobolRedefinedFieldValue)value).getValue(); } return value; } }
/** * overrides get method to allow on-demand extraction. */ public Object get(Object key) { Object value = super.get(key); if (value instanceof CobolRedefinedFieldValue) { value = ((CobolRedefinedFieldValue)value).getValue(); } return value; }
/** * overrides get method to allow on-demand extraction. */ public Object get(String fieldName) { Object value = super.get(fieldName); if (value instanceof CobolRedefinedFieldValue) { value = ((CobolRedefinedFieldValue)value).getValue(); } return value; }
/** * overrides get method to allow on-demand extraction. */ public Object get(DatabaseField key) { Object value = super.get(key); if (value instanceof CobolRedefinedFieldValue) { value = ((CobolRedefinedFieldValue)value).getValue(); } return value; } }
/** * overrides get method to allow on-demand extraction. */ public Object get(String fieldName) { Object value = super.get(fieldName); if (value instanceof CobolRedefinedFieldValue) { value = ((CobolRedefinedFieldValue)value).getValue(); } return value; }
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
/** * INTERNAL: * Retrieve the value for the field. If missing null is returned. */ public Object get(DatabaseField key) { if (this.fieldsArray != null) { // Optimize check. int index = key.index; if ((index >= 0) && (index < this.size)) { DatabaseField field = this.fieldsArray[index]; if ((field == key) || field.equals(key)) { return this.valuesArray[index]; } } for (int fieldIndex = 0; fieldIndex < this.size; fieldIndex++) { DatabaseField field = this.fieldsArray[fieldIndex]; if ((field == key) || field.equals(key)) { // PERF: If the fields index was not set, then set it. if (index == -1) { key.setIndex(fieldIndex); } return this.valuesArray[fieldIndex]; } } return null; } else { return super.get(key); } }
/** * INTERNAL: * Retrieve the value for the field. If missing null is returned. */ public Object get(DatabaseField key) { if (this.fieldsArray != null) { // Optimize check. int index = key.index; if ((index >= 0) && (index < this.size)) { DatabaseField field = this.fieldsArray[index]; if ((field == key) || field.equals(key)) { return this.valuesArray[index]; } } for (int fieldIndex = 0; fieldIndex < this.size; fieldIndex++) { DatabaseField field = this.fieldsArray[fieldIndex]; if ((field == key) || field.equals(key)) { // PERF: If the fields index was not set, then set it. if (index == -1) { key.setIndex(fieldIndex); } return this.valuesArray[fieldIndex]; } } return null; } else { return super.get(key); } }
/** * INTERNAL: * Retrieve the value for the field. If missing DatabaseRow.noEntry is returned. */ public Object getIndicatingNoEntry(DatabaseField key) { if (this.fieldsArray != null) { // Optimize check. int index = key.index; if ((index >= 0) && (index < this.size)) { DatabaseField field = this.fieldsArray[index]; if ((field == key) || field.equals(key)) { return this.valuesArray[index]; } } for (int fieldIndex = 0; fieldIndex < this.size; fieldIndex++) { DatabaseField field = this.fieldsArray[fieldIndex]; if ((field == key) || field.equals(key)) { // PERF: If the fields index was not set, then set it. if (index == -1) { key.setIndex(fieldIndex); } return this.valuesArray[fieldIndex]; } } return AbstractRecord.noEntry; } else { return super.get(key); } }
/** * INTERNAL: * This method is for processing all FieldResults for a mapping. Adds DatabaseFields to the passed in entityRecord */ public void getValueFromRecordForMapping(DatabaseRecord entityRecord,DatabaseMapping mapping, FieldResult fieldResult, DatabaseRecord databaseRecord){ ClassDescriptor currentDescriptor = mapping.getReferenceDescriptor(); /** check if this FieldResult contains any other FieldResults, process it if it doesn't */ if (fieldResult.getFieldResults()==null){ DatabaseField dbfield = processValueFromRecordForMapping(currentDescriptor,fieldResult.getMultipleFieldIdentifiers(),1); /** If it is a 1:1 mapping we need to do the target to source field conversion. If it is an aggregate, it is fine as it is*/ if (mapping.isOneToOneMapping()){ dbfield = (((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(dbfield)); } entityRecord.put(dbfield, databaseRecord.get(fieldResult.getColumn())); return; } /** This processes each FieldResult stored in the collection of FieldResults individually */ Iterator fieldResults = fieldResult.getFieldResults().iterator(); while (fieldResults.hasNext()){ FieldResult tempFieldResult = ((FieldResult)fieldResults.next()); DatabaseField dbfield = processValueFromRecordForMapping(currentDescriptor,tempFieldResult.getMultipleFieldIdentifiers(),1); if (mapping.isOneToOneMapping()){ dbfield = (((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(dbfield)); } entityRecord.put(dbfield, databaseRecord.get(tempFieldResult.getColumn())); } }
/** * INTERNAL: * This method is for processing all FieldResults for a mapping. Adds DatabaseFields to the passed in entityRecord */ public void getValueFromRecordForMapping(DatabaseRecord entityRecord,DatabaseMapping mapping, FieldResult fieldResult, DatabaseRecord databaseRecord){ ClassDescriptor currentDescriptor = mapping.getReferenceDescriptor(); /** check if this FieldResult contains any other FieldResults, process it if it doesn't */ if (fieldResult.getFieldResults()==null){ DatabaseField dbfield = processValueFromRecordForMapping(currentDescriptor,fieldResult.getMultipleFieldIdentifiers(),1); /** If it is a 1:1 mapping we need to do the target to source field conversion. If it is an aggregate, it is fine as it is*/ if (mapping.isOneToOneMapping()){ dbfield = (((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(dbfield)); } entityRecord.put(dbfield, databaseRecord.get(fieldResult.getColumn())); return; } /** This processes each FieldResult stored in the collection of FieldResults individually */ Iterator fieldResults = fieldResult.getFieldResults().iterator(); while (fieldResults.hasNext()){ FieldResult tempFieldResult = ((FieldResult)fieldResults.next()); DatabaseField dbfield = processValueFromRecordForMapping(currentDescriptor,tempFieldResult.getMultipleFieldIdentifiers(),1); if (mapping.isOneToOneMapping()){ dbfield = (((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(dbfield)); } entityRecord.put(dbfield, databaseRecord.get(tempFieldResult.getColumn())); } }
/** * INTERNAL: * This method is for processing all FieldResults for a mapping. Adds DatabaseFields to the passed in entityRecord */ public void getValueFromRecordForMapping(DatabaseRecord entityRecord,DatabaseMapping mapping, FieldResult fieldResult, DatabaseRecord databaseRecord){ ClassDescriptor currentDescriptor = mapping.getReferenceDescriptor(); /** check if this FieldResult contains any other FieldResults, process it if it doesn't */ if (fieldResult.getFieldResults()==null){ DatabaseField dbfield = processValueFromRecordForMapping(currentDescriptor,fieldResult.getMultipleFieldIdentifiers(),1); /** If it is a 1:1 mapping we need to do the target to source field conversion. If it is an aggregate, it is fine as it is*/ if (mapping.isOneToOneMapping()){ dbfield = (((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(dbfield)); } entityRecord.put(dbfield, databaseRecord.get(fieldResult.getColumnName())); return; } /** This processes each FieldResult stored in the collection of FieldResults individually */ Iterator fieldResults = fieldResult.getFieldResults().iterator(); while (fieldResults.hasNext()){ FieldResult tempFieldResult = ((FieldResult)fieldResults.next()); DatabaseField dbfield = processValueFromRecordForMapping(currentDescriptor,tempFieldResult.getMultipleFieldIdentifiers(),1); if (mapping.isOneToOneMapping()){ dbfield = (((OneToOneMapping)mapping).getTargetToSourceKeyFields().get(dbfield)); } entityRecord.put(dbfield, databaseRecord.get(tempFieldResult.getColumnName())); } }
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");