Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents


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 DeferredChangeDetectionPolicy.


(Optional) The workingCopyoMethod that will be used to create a clone that will be used when registering an object in an EclipseLink UnitOfWork.


You must specify either a method or workingCopyMenthod.


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.


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", 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: