Use @CloneCopyPolicy to specify an org.eclipse.persistence.descriptors.copying.CloneCopyPolicy on an Entity.
Annotation Elements
Table 2-11 describes this annotation's elements.
Table 2-11 @CloneCopyPolicy Annotation Elements
| Annotation Element | Description | Default |
|---|---|---|
|
|
(Optional) The method that will be used to create a clone for comparison with EclispeLink's |
|
|
|
(Optional) The |
|
You must specify either a |
Usage
The clone method should perform a shallow clone of the object. This can be used to clone non-persistent fields from a instance in the shared cache.
You can specify @CloneCopyPolicy on an Entity, MappedSuperclass, or Embeddable class.
Examples
Example 2-25 and Example 2-26 show several examples of the @CloneCopyPolicy annotation and <clone-copy-policy> XML element, respectively.
Example 2-25 Using @CloneCopyPolicy Annotation
@CloneCopyPolicy(method="myClone")
@CloneCopyPolicy(method="myClone", workingCopyMethod="myWorkingCopyClone")
@CloneCopyPolicy(workingCopyMethod="myWorkingCopyClone")
Example 2-26 Using <clone-copy-policy> XML
<clone-copy-policy type="copy" method="myClone" workingCopyMethod="myWorkingCopyClone"/>
<clone-copy-policy type="copy" workingCopyMethod="myWorkingCopyClone"/>
<clone-copy-policy type="copy" method="myClone"/>
See Also
For more information, see:
Understanding EclipseLink