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


Use @CopyPolicy to set an org.eclipse.persistence.descriptors.copying.CopyPolicy on an entity to produce a copy of the persistent element.

Annotation Elements

Table 2-17 describes this annotation's elements.

Table 2-17 @CopyPolicy Annotation Elements

Annotation Element Description Default


(Required) The class of the copy policy. The class must implement org.eclipse.persistence.descriptors.copying.CopyPolicy.


You can specify @CopyPolicy on an Entity, MappedSuperclass, or Embeddable class.


Example 2-34 shows how to use this annotation.

Example 2-34 Using @CopyPolicy Annotation

  public class Employee implements Serializable {

Example 2-35 shows how to use the <copy-policy> element in the eclipselink-orm.xml file.

Example 2-35 Using <copy-policy> XML

<entity class="Employee">
  <table name="EMPLOYEE"/>
  <copy-policy class="mypackage.MyCopyPolicy"/>

See Also

For more information, see: