Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 8:13:33 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

September 2003
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Aug   Oct

Get Firefox!

Wednesday, September 17, 2003

When a view object includes multiple entity object usages, by default the key for the view row is comprised of all of the key attributes for all of the participating entity usages in that view. Each entity usage in a view object can be marked as participating in a Read-Only way and can be marked as participating by Reference. By default, our design time editor marks the first entity usage in a view object as not Read Only and not a Reference. Second and subsequent entity usages by default get their Read Only and Reference checkmark set to on, however you can override this default by unchecking the boxes as appropriate. Also, the view object attributes can be named and ordered using the View Object wizard, independently of the underlying entity objects and entity object attributes that they are mapped to.

For each view object attribute mapped to an entity attribute from an entity usage which is participating in an updateable and non-reference way in the view object, the view-object-attribute level "Key Attribute" checkbox will be checked on and be disabled in the UI since these attributes must stay as part of the view object row key. For each view object attribute mapped to an entity attribute from an entity usage that is either ReadOnly or Reference, its "Key Attribute" checkbox will be initially checked if the underlying entity attribute is a key attribute. However, in this latter case you can uncheck the attribute if you don't want it to participate in the view row key.

So, the answer to the question is that, after optionally unchecking the "Key Attribute" flag for the view attributes mapped to entity attributes from entity usages which are either ReadOnly or Reference, you will have a view row key that is comprised of the attributes marked as "Key Attribute" in the view object attribute properties, and they will appear in the Key in the order that you have arranged the view object attributes.

You can use the ViewObject API getKeyAttrDefs() to retrieve an AttributeDef[] of the attribute in the key for the view row related to any view object. This API is actually available on any RowIterator, including the default row iterator of the default rowset of the view object. You can also use the static createKey() helper method on oracle.jbo.common.RowSetIteratorHelper to create a key using any object that implements oracle.jbo.AttributeList. For example, any Row object implements that interface, as well as the oracle.jbo.NameValuePairs class for constructing new attribute lists from scratch. This createKey() helper method worries about returning a Key object with the attributes in the correct order.


6:14:46 PM    



© Copyright 2008 Steve Muench.