Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2) Part No. B15900-01 |
|
Previous |
Next |
OracleAS TopLink allows you to use wrappers (or proxies) in cases where the persistent class is not the same class that is to be presented to users.
For example, in the Enterprise JavaBeans specification, the Entity bean class (the class that implements javax.ejb.EntityBean) is persistent but is hidden from users who interact with a class that implements javax.ejb.EJBObject (the remote interface class). In this example, the EJBObject acts as a proxy or wrapper for the EntityBean. In cases where such a wrapper is used, OracleAS TopLink continues to make the class specified in the descriptor persistent, but returns the appropriate instance of the wrapper whenever a persistent object is requested.Use a wrapper policy to tell OracleAS TopLink how to create wrappers for a particular persistent class, and how to obtain the underlying persistent object from a given wrapper instance. If you specify a wrapper policy, OracleAS TopLink uses the policy to wrap and unwrap persistent objects as required:
Wrapper policies implement the interface oracle.toplink.descriptors.WrapperPolicy
.
A wrapper policy is specified by setting the wrapper policy for the OracleAS TopLink descriptor.
By default, no wrapper policy is used (the wrapper policy for a descriptor is null by default).
Wrapper policies cannot be set using the OracleAS TopLink Mapping Workbench and can only be set using Java code.
Note: Wrapper policies are advanced OracleAS TopLink options. Using a wrapper policy may not be compatible with some OracleAS TopLink Mapping Workbench features. |
The Descriptor
class provides methods used in conjunction with the wrapper policy:
setWrapperPolicy(oracle.toplink.descriptors.WrapperPolicy)
can be invoked to provide a wrapper policy for the descriptor.
getWrapperPolicy()
returns the wrapper policy for a descriptor.
Refer to the, Oracle Application Server TopLink Application Developer's Guide, for detailed information.