Queries Tab

Click the appropriate SQL function tab and type your own SQL string to control these actions for a descriptor. Use the following information to complete the tab:

Tab | Description
--- | ---
Insert | Defines the insert SQL that TopLink uses to insert a new object's data into the database.

Update

Defines the update SQL that TopLink uses to update any changed existing object's data in the database.

When you define a descriptor's update query, you must conform to the following:

- If the application uses optimistic locking, you must ensure that the row is not written if the version field has changed since the object was read.

- The update query must increment the version field if the row is written.

- The update string must maintain the row count of the database.

Delete | Defines the delete SQL that TopLink uses to delete an object.

Read Object

Defines the read SQL that TopLink uses in any `ReadObjectQuery`, whose selection criteria is based on the object's primary key.

When you define a descriptor's read-object query, your implementation overrides any `ReadObjectQuery`, whose selection criteria is based on the object's primary key. TopLink generates dynamic SQL for all other `Session` `readObject` method signatures.

To customize other `Session` `readObject` method signatures, define additional named queries and use them in your application instead of the `Session` methods.

Read All

Defines the read-all SQL that TopLink uses when you call `Session` method `readAllObjects(java.lang.Class)` passing in the `java.lang.Class` that this descriptor represents.

When you define a descriptor's read-all query, your implementation overrides only the `Session` method `readAll(java.lang.Class)`, not the version that takes a `Class` and `Expression`. As a result, this query reads every single instance. TopLink generates dynamic SQL for all other `Session` `readAll` method signatures.

To customize other `Session` `readAll` method signatures, define additional named queries and use them in your application instead of the Session methods.

See Also

  Configuring Custom SQL Queries for Basic Persistence Operations