Working with a Wrapper Policy

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, 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 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, TopLink uses the policy to wrap and unwrap persistent objects as required:


Related Topics

About TopLink Descriptors

Setting the Wrapper Policy Using Java Code
Working with Descriptors

 

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