Use @ReadOnly
to specify that a class is read-only.
This annotation contains no elements.
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 Oracle TopLink'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 TopLink cache. To modify a read-only entity, it must cloned or serialized.
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">
For more information, see: