By default, TopLink uses direct access to access public attributes. Alternatively, you can use accessor methods to access object attributes when writing the attributes of the object to the database or reading the attributes of the object from the database. This is known as method access.
The attribute's visibility (public, protected, private, or package visibility) and the supported version of JDK may restrict the type of access that you can use.
Starting with JDK 1.2, the Java Core Reflection API provides a means to suppress default Java language access control checks when using reflection. TopLink uses reflection to access the application's persistent objects. This means that if you are using a VM that supports the API, then TopLink can access an attribute directly, regardless of its declared visibility.
Oracle recommends using direct access whenever possible to improve performance and avoid executing any application-specific behavior while building objects.
Use the General tab of the specific mapping (see Figure 5-2) to set the access type as direct or method-based.
To change the default access type used by all new mappings, use the Defaults tab on the TopLink Mapping editor. See "Specifying Default Properties" for more information.
Copyright © 1997, 2004, Oracle. All rights reserved.