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


@CopyPolicy

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

java.lang.Class

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




Usage

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


Examples

Example 2-34 shows how to use this annotation.

Example 2-34 Using @CopyPolicy Annotation

@Entity
  @Table(name="EMPLOYEE")
  @CopyPolicy(mypackage.MyCopyPolicy.class)
  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"/>
...
</entity>


See Also

For more information, see: