Retrieving Attribute Values

Once you have retrieved a row (either by inserting it or navigating to it; see the related topics list for more information), you can retrieve attribute values in one of two ways: call getAttribute() on the Row, or use exposed accessors.

Calling getAttribute()

Call getAttribute() on the Row, passing the name of the attribute in as a String. The attribute will be returned as type Object, and so must be cast to a more specific data type for most purposes:

Number currentOrdId = (Number) currentRow.getAttribute("OrderId");

Using Accessors

If you have exposed accessors for the view object, you can instead:

  1. Make sure you have imported the common subpackage of the package containing your view object definition. For example, if your view object is defined in orderentry.datamodel, you would use:
    import orderentry.datamodel.common.*;
  2. Cast the Row to your custom view row interface (generally the name of the view object definition, plus the word "Row" at the end, e.g., OrdersViewRow):

    OrdersViewRow currentOrder = (OrdersViewRow) currentRow;

    Note: You can also cast the Row at the same time you retrieve it.

  3. Call the typesafe getter for the attribute (the getter name is the name of the attribute plus the word "get" at the beginning, e.g., getOrderId()). The attribute will be returned as its true Java type:

    Number currentOrdId = currentOrder.getOrderId();


Accessing Data from Clients
About the Multi-Tiered Business Components Architecture
About Oracle ADF View Objects
About View Object Attributes
About View Object Java Classes
Ways to Navigate Through Query Results
Inserting a Row
Updating a Row

 

 

Copyright © 1997, 2004, Oracle. All rights reserved.