Use @ReadOnly
to specify that a class is read-only.
Annotation Elements
This annotation contains no elements.
Usage
It may be defined on an Entity or MappedSuperclass.
In the case of inheritance, a @ReadOnly
annotation can only be defined on the root of the inheritance hierarchy .
You can also use @ReadOnly
to bypass EclipseLink's persistence context to save heap space (such as if you need to load a large dataset).
Note: You should not modify read-only entities. Doing so can corrupt the EclipseLink cache. To modify a read-only entity, it must cloned or serialized. |
Examples
Example 2-97 shows how to use this annotation.
Example 2-97 Using @ReadOnly Annotation
@ReadOnly @Entity @Table(name = "TMP_READONLY") public class ReadOnlyEntity { ... }
Example 2-98 shows how to use the <read-only>
element in the eclipselink-orm.xml
file.
Example 2-98 Using <read-only> XML
<entity name="XMLReadOnlyClass" class="ReadOnlyClass" access="PROPERTY" read-only="true">
See Also
For more information, see: