Skip Headers

# Session Queries

Previous

Next

Sessions provide query methods that lets you perform the object operations listed in Table: Session Object Query Summary.

Session Object Query Summary

Session Type | Create | Read | Update | Delete
--- | --- | --- | --- | ---
`UnitOfWork` | NA | `readObject` `readAllObjects` | NA | `deleteObject` `deleteAllObjects`
`Server` | NA | NA | NA | NA
`ClientSession` | NA | `readObject` `readAllObjects` | NA | NA
`DatabaseSession` | `insertObject` | `readObject` `readAllObjects` | `updateObject` `writeObject` `writeAllObjects` | `deleteObject` `deleteAllObjects`

Note: Oracle recommends that you perform all data source operations using a unit of work: doing so is the most efficient way to manage transactions, concurrency, and referential constraints. For more information, see "Understanding TopLink Transactions".

These methods implicitly construct and execute a `DatabaseQuery` based on any of the following input parameters and return `Object` or `Object` collection:

- Reference `Class` (the `Class` of objects that the query accesses)

- Reference `Class` and `Call`

- Reference `Class` and `Expression`

- Example object with primary key set

These methods are a convenient way to perform the most common data source operations on objects.

WARNING: Allowing an unverified SQL string to be passed into these methods makes your application vulnerable to SQL injection attacks.

To access all configurable options to further refine and optimize a query, consider using a corresponding `DatabaseQuery` directly. For more information, see "Database Queries".

For more information, see "Using Session Queries".