Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
You do not instantiate an instance of oracle.toplink.sessions.UnitOfWork
. Rather, you acquire a unit of work from an instance of oracle.toplink.sessions.Session
or from another unit of work.
For more information on creating sessions, see "Creating Sessions".
For more information on acquiring a unit of work, see "Acquiring a Unit of Work".
For more information on using the basic API of the unit of work, see "Using Basic Unit of Work API".
For more information on using the advanced API of the unit of work, see "Using Advanced Unit of Work API".
The unit of work extends the interface oracle.toplink.sessions.Session
, and implements all the usual session API. When using session API from a unit of work, you should consider the following:
A unit of work offers the same set of database access methods as a regular session.
When called from a unit of work, these methods access the objects in the unit of work, register the selected objects automatically, and return clones.
Although this makes it unnecessary for you to call the registerObject
and registerAllObjects
methods, be aware of the restrictions on registering objects described in "Creating an Object" and "Associating a New Source to an Existing Target Object".
As with regular sessions, you use the readObject
and readAllObjects
methods to read objects from the database.
For information on locking API generic to all sessions, see:
For information on locking API specific to a unit of work, see "Using Optimistic Read Locking with forceUpdateToVersionField".