Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Read-Only Descriptors

You can configure a relational class or EIS root descriptor as read-only. This indicates that instances of the reference class will never be modified.

Read-only descriptors are usually used within a unit of work as a performance gain, because there is no need to register, clone, and merge the read-only classes. For more information, see Chapter 100, "Understanding TopLink Transactions".

In a CMP project, you can declare an entity bean as read-only within the TopLink deployment XML file. For more information, see "Using Read-Only Entity Beans".

Table 28-4 summarizes which descriptors support read-only configuration.

Table 28-4 Descriptor Support for Read Only

Descriptor Using TopLink Workbench
Using Java

Relational DescriptorsFoot 1 

Supported.


Supported.


Object-Relational Descriptors

Unsupported.


Supported.


EIS DescriptorFoot 2 

Supported.


Supported.


XML Descriptors

Unsupported.


Unsupported.



Footnote 1 Relational class descriptors only (see "Relational Class Descriptors").

Footnote 2 EIS root descriptors only (see "EIS Root Descriptors")


Note:

Relational aggregate and EIS composite descriptors get their read-only setting from their owner.

Using Read-Only Entity Beans

TopLink can declare a CMP entity bean as read-only. This ensures that the entity bean cannot be modified and allows TopLink to optimize unit of work performance.

If an attempt is made to modify a read-only entity bean (create, update, or remove), TopLink immediately throws a javax.ejb.EJBException: TopLink does not wait until the transaction commits.

If an attempt is made to change a CMR field on a read-only entity bean, TopLink throws a javax.ejb.EJBException.

When TopLink is configured as the OC4J persistence manager, the TopLink read-only bean configuration replaces the OC4J READ-ONLY CMP concurrency mode.

Using TopLink Workbench

To configure a descriptor as read-only use this procedure:

  1. Select a descriptor in the Navigator. Its properties appear in the Editor.

  2. Click the Descriptor Info tab. The Descriptor Info tab appears.

    Figure 28-2 Descriptor Info Tab, Read Only Option

    Description of Figure 28-2  follows
    Description of "Figure 28-2 Descriptor Info Tab, Read Only Option"

Specify whether this descriptor is read-only or not.

Using Java

Use ClassDescriptor method setReadOnly.