A.1 How the Tables Should Be Read


Take a look at the first field in the first column (transient) and first row (makePersistent). This field means that if PersistenceManager.makePersistent is called with an instance, which state is transient, the resulting state is persistent-new . To keep the table short, not all operations are explicitly listed. For instance, PersistenceManager.makePersistentAll(Collection c) and PersistenceManager.makePersistentAll(Object[] o) have the same effect on instances contained in the collection or array, just as makePersistent() has on a single instance. The same is true for deletePersistent , makeTransient , makeTransactional , and makeNontransactional , respectively.

If a field is marked "Error!", the corresponding operation on an instance is not allowed and causes a JDOUserException to be thrown. The state will not change.

If a field is marked " Impossible ", the operation cannot be performed on an instance because the initial state is not reachable . For instance, there are no instances that have the state persistent-new outside of active transactions, so "read fields outside of active transactions" cannot be performed.

If a " “" (dash) appears in a field, the state does not change.

Table A-1. State Transitions

Current State

Transient

Persistent-new

Persistent-clean

Persistent-dirty

Hollow

Method

         

makePersistent

persistent-new

deletePersistent

error!

persistent-new-deleted

persistent-deleted

makeTransactional

transient-clean

makeNonTransactional

error!

persistent-nontrans.

error!

makeTransient

error!

transient

error!

transient

commit

Hollow

commit (retain values)

persistent-nontrans.

rollback

transient

Hollow

rollback (retain values)

transient

persistent-nontrans.

refresh (active)

persistent-clean

refresh (optimistic)

persistent-nontrans.

evict

n/a

hollow

read field (outside)

impossible

persistent-nontrans.

read field (optimistic)

persistentpnontrans.

read field (active)

persistent-clean

write field (outside)

impossible

persistent-nontrans.

write field (active)

persistent-dirty

persistent-dirty

retrieve (outside or optimistic)

persistent-nontrans.

retrieve (active)

persistent-clean

Table A-2. State Transitions

Current State

Transient-clean

Transient-dirty

Persistent-new-deleted

Persistent-deleted

Persistent-nontrans.

Method

         

makePersistent

persistent-new

deletePersistent

error!

persistent-deleted

makeTransactional

persistent-clean

makeNonTransactional

Transient

error!

makeTransient

error!

transient

commit

transient-clean

transient

commit (retain values)

transient-clean

transient

rollback

transient-clean

transient

hollow

rollback (retain values)

transient-clean

transient

persistent-nontrans.

refresh (active)

refresh (optimistic)

evict

hollow

read field (outside)

impossible

read field (optimistic)

error!

read field (active)

error!

persistent-clean

write field (outside)

impossible

write field (active)

transient-dirty

error!

persistent-dirty

retrieve (outside or optimistic)

retrieve (active)

persistent-clean



Core Java Data Objects
Core Java Data Objects
ISBN: 0131407317
EAN: 2147483647
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net